SSH/SFTP: Create and Restrict a User to his Home Directory on a Ubuntu Server

On May 11, 2018, in Shell, Unix/Linux, by Dipin Krishna

This is a step by step guide to create a new user and restrict the user to his home directory. 1. Create a new user   sudo adduser TestUser 2. Change the ownership of TestUser’s home directory to root.   sudo chown root:root /home/TestUser 3. Edit the ssh config file   sudo vim /etc/ssh/sshd_config and […]

Tagged with:  

Use WGET to recursively download the whole FTP directory

On February 15, 2013, in General, Shell, by Dipin Krishna

I wanted to copy all of the files and folders from my current host to my new server. And I only have FTP access to that current host. My new server is running Ubuntu, and i hated using the FTP command. But i had to some how download the whole directory of files. Can’t use […]

Tagged with:  

SED: Shell command to find and replace text inside a directory (multiple files)

On June 21, 2012, in Shell, Unix/Linux, by Dipin Krishna

I have been using this command for a long time now. Whenever i am in need of this command, i won’t be remembering the correct syntax. So, i google it each time. Now, i am gonna write it down here. sed is a marvelous utility. Unfortunately, most people never learn its real power. The language […]

Tagged with:  

Inline Shell Script with a For Loop

On November 19, 2008, in for loop, Inline, Script, Shell, by Dipin Krishna

Often I’m asked how to traverse a list of items in a file. You can easily go through a list of items using a for loop. Here’s an example of copying selected contents of originalDir to destinationDir via the command line. #sh #for i in `cat /home/esofthub/mylist.dat` #do #cp -pr /originalDir/$i /destinationDir/. #echo $i done #done […]