Tuesday, 13 June 2023

Enable 'HTML Manager'- Apache Tomcat

 Enable 'HTML Manager'- Apache Tomcat


Go to Apache-tomcat's home directory and edit the tomcat-users.xml


${apache_home}/conf/tomcat-users.xml


Add/uncomment the below lines in tomcat-users.xml and save it.


<role rolename="admin"/>

<role rolename="admin-gui"/>

 <role rolename="manager"/>

 <role rolename="manager-gui"/>

<user username="uname" password="password" roles="admin,admin-gui,manager,manager-gui"/>


Note: Replace the username and password as per your choice.

Give a try to access the html manager using the below url.

http://<IP:port>/manager/html

Feed the username and password if prompted.


If you are getting the error - 403 Access Denied , then try below to fix it.


Goto the manager project directory and edit the context.xml


${apache_home}/webapps/manager/META-INF/


comment the tag- Valve , OR seed your ip in the allow variable.


Wednesday, 31 May 2023

Create user Ubuntu with the command and directory restriction

 Create User:

    sudo useradd -m user_name -s /bin/rbash

    sudo passwd user_name

    Enter password


Make Directory and grant permission  

    sudo mkdir /home/user_name/bin

    sudo chown root. /home/user_name/.profile

    sudo chmod 755 /home/user_name/.profile


Restrict Directory and access


sudo vim /home/user_name/.profile


################ADD BELOW IN FILE#######

# if running bash

if [ -n "$BASH_VERSION" ]; then

    # include .bashrc if it exists

    if [ -f "$HOME/.bashrc" ]; then

. "$HOME/.bashrc"

    fi

fi


# set PATH so it includes user's private bin if it exists

PATH=$HOME/bin


export PATH

#########################################


Assign Commands

sudo ln -s /bin/grep /home/user_name/bin/tail

sudo ln -s /bin/cat /home/user_name/bin/cat

sudo ln -s /bin/echo /home/user_name/bin/more

Create SFTP user with home directory restriction

 



Restrict on the home directory and sftp only Ubuntu

create a group -
 
sudo addgroup group_name

create a user

useradd -m -d /home/username username

Assign group to user

usermod -g group_name username


restrict the directory and ftp

add below to the end of /etc/ssh/sshd_config file

   Match Group group_name
   ChrootDirectory /home/username
   ForceCommand internal-sftp
   X11Forwarding no
   AllowTcpForwarding no


Still unable to log in to sftp try to change the ownership to root for the user's home directory. 

Also check the mod of the home directory, it should be 755

Saturday, 15 December 2018

Upgrade GLIBC Rhel/CentoOs

To upgrade glibc below package are reuqired.


  • glibc
  • glibc-common
  • glibc-devel
  • glibc-headers
  • glibc-static
  • glibc-utils
Download the above packages from below link, and copy in /tmp directoyr.

Download Package From here 

Make sure all above package should be in same version.


go to the /tmp directory and execute below command to update the packages.

rpm -Uvh glibc-2.17-55.el6.x86_64.rpm \
glibc-common-2.17-55.el6.x86_64.rpm \
glibc-devel-2.17-55.el6.x86_64.rpm \
glibc-headers-2.17-55.el6.x86_64.rpm \
glibc-static-2.17-55.el6.x86_64.rpm \
glibc-utils-2.17-55.el6.x86_64.rpm



Check the lattest install version.

rpm -qa |grep glibc

Saturday, 19 May 2018

Mount FTP share locally in Linux using ftpfs

Mount FTP share locally in Linux using ftpfs

 To mount a remote FTP account to locally on Linux system- 

1)Install required Packages
2)Mounting system with remote details
3)Testing

1) - Install fuse-curlftpfs package on you Linux system.

2)- After package installation need to create a mount point(directory) and mount ftp server data using curlftpfs command, to do this you must have ftp details. 

Consider below details.
 
 ftp User: altmish
 ftp Password: tech2smooth
 ftp Host:- ftp.tech2smooth.in
 Mount Directory:-  /usr/ftp_data

Create the mount point and mount ftp account data.
[root@localhost /]#mkdir /usr/ftp_data
[root@localhost /]#curlftpfs -o altmish:tech2smooth@ftp.tech2smooth.in /usr/ftp_data

Note: Above mounted data will be accessible only for the user who mounted the system. To make it public-ally accessible use below.


[root@localhost /]#curlftpfs -o allow_other altmish:tech2smooth@ftp.tech2smooth.in /usr/ftp_data

 3)- Go to ftp data directory

[root@localhost /]#cd /usr/ftp_data

[root@localhost /]#ls -ltrh

Saturday, 5 May 2018

Memory Leak in tomcat

To prevent this particular memory leak you should edit your tomcat/conf/server.xml and change

<Listener  lassName="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
to

<Listener 
className="org.apache.catalina.core.JreMemoryLeakPreventionListener"
classesToInitialize="com.mysql.jdbc.NonRegisteringDriver" />

Error parsing HTTP request header- Invalid character found in the request target.



Http11Processor.service Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
 java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986


Solution

Edit catalina.properties add below line in end of the file.

tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}

 
 

Enable 'HTML Manager'- Apache Tomcat

 Enable 'HTML Manager'- Apache Tomcat Go to Apache-tomcat's home directory and edit the tomcat-users.xml ${apache_home}/conf/tom...