RSSAll Entries Tagged With: "ssh"

How to create a large file for testing purpose ?

Issue : How can a large file, say 1GB, for some testing purposes be created? Solution : Use the following command : dd if=/dev/zero of= filename bs=1024 count=1024number of 0′s Replace ‘filename’ with the actual filename. Replace ‘number of 0′s’ with the required number of 0′s For example, One ’0′ for 10MB , two for [...]

How to find the number of user accounts via shell ?

Issue : There is no control panel installed on the server. So, how can the total number of user accounts on the system be determined? Solution: Use the following command to find the total number of accounts on the system : cat /etc/passwd | wc -l Note : This will also include system accounts like [...]

Disabling an email account

Issue : How can a particular email account be ‘disabled’ temporarily. Note that the email account should not be ‘deleted’ ? Is this possible at all via cPanel? Solution : There is no direct functionality in cPanel at the moment for this. This feature might be added at a later stage. However, you can achieve [...]

How to transfer a folder from one server to another

Issue : Need to transfer a folder from a remote server to the local server. Solution : One way of doing this is using the ‘wget’ command. First, log in to your server via SSH and and launch wget mirroring using the following command : wget -m ftp://username:password@ftp.host/folder/ Do replace the above with the corresponding [...]

How to prevent SFTP users from viewing server files and folders

Issue : SFTP users can view server files and folders by simply changing the path to ‘/’. How can this be avoided? Solution : SFTP means FTP access over SSH. You will have to chroot the individual users in order to prevent them from viewing files outside their chroot jail. Normal FTP access has chroot [...]

How to find files containing a specific word ?

Issue : How to find files containing a specific word and store the results in another text file ? Solution : Use the following command : grep -R word /directory/* > filename Use -iR instead of -R for case insensitive search. This approach will take some time depending on the size and number of files. [...]

How to resolve multiple problems due to permission issues

Sometimes, permissions might get screwed server wide resulting in various problems for different users. Here are some steps to reset the permissions. /scripts/checkbsdgroups — Checks and repairs proftpd ownership on FreeBSD. /scripts/chownpublichtmls — Change ownership of all users web space to them, which is useful for converting to suexec. Files owned by nobody are deleted. [...]

Changing the default port for SSH

Issue : How to change the default port for SSH? Solution : Open the port (which you want to use for SSH) in the server firewall and restart the firewall to apply the change. Then, open the configuration file /etc/ssh/sshd_config using your favorite editor and change : #Port 22 to Port x Replace ‘x’ with [...]

Changing IPs for multiple accounts on a server

Issue : How to change the IPs of multiple accounts on a server in one go? The option in WHM is tedious. Hence, it does not serve the purpose. Solution : You need to have ‘root’ SSH access in order to do this. Create a file and put the concerned accounts in it in the [...]

Pointing a sub-domain to folder outside public_html

Issue : When you create a sub-domain, cPanel points it to the corresponding folder under public_html by default. How to point it to a folder outside the public_html? Solution : This cannot be done via cPanel/WHM but can be achieved if you have ‘root’ SSH access to the server. 1. Open the apache configuration file [...]

SSH connection drops on being idle

Issue : The SSH connection times out on few minutes of inactivity. Fix : Most likely, you are using SSH protocol 2 . To get around the above problem, you can simply increase the ClientAliveInterval in the file /etc/ssh/sshd_config to (say) 300 seconds.

Jailshell not allowing basic commands

Issue : After allocating jailshell , the user is not able to use commands like ‘ls’ , ‘touch’ , ‘mkdir’ etc. within his own home directory. Fix: Try the following steps : 1. Get into the directory /home/virtfs/username/home/ via SSH and check the ownership and permissions of the folder named username inside this directory. The [...]

How to check who/when logged in via SSH

Issue : How to check successful and failed SSH logins to the server ? Solution : Use the following commands (as root) to achieve this : last | less This captures data from /var/log/wtmp and shows you the successful logins. lastb | less This captures data from /var/log/btmp and shows you the failed attempts. Source [...]

Automatic backups using SSH

Issue : How to go about setting up backups using SSH so that backups of every account are uploaded automatically from server1 to server2 ? Solution : 1. Make SSH password less (key based) from destination to source. 2. Run a rsync from destination to get files from source. 3. Set it as a cron [...]

SFTP without SSH

Issue : How to allow SFTP but disallow shell-level access ? Solution : To allow SFTP access but without shell access, you must first enable (jailed) shell via WHM. But then run the following so they do not have command line/shell access: usermod -s /usr/local/cpanel/bin/noshell username Of course, replace “username” with the actual account user [...]

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
InstaCarma provides outsourced web hosting technical support, helpdesk management, datacenter automation, cloud service management. Sales - 1800 810 6547 - visit www.instacarma.com