Adding a User to Ubuntu
So, after I got my EC2 instance first setup, I wanted to know how the heck to manage the WordPress theme I have on it. As a developer, the only real way I knew of getting files onto a web server is by using FTP or SFTP. Up to this point, I was using the .pem file to get connected and manage my server, so I figured let’s get FTP working! Well FTP seemed to be a long and painful process, however, SFTP is short and sweet.
So the first thing I do after getting logged onto the server is to add a user
sudo useradd -d /home/sublet -m sublet
Then I need to set a password.
sudo passwd sublet
Basically, what we have done is created the user sublet, and set his/her home directory. Now if we trust this user, and want to give them full access to the box…continue reading.
Now go to the line that says User privilege specification. Basically, all you have to do is copy the root entry and replace “root” with your new username.
sublet ALL=(ALL) ALL
Exit and Save, and you have now given this new user, admin access.
To connect using SFTP we need to run a few commands to enable the new users access.
First Create a Backup copy of the SSH config file.
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original
Set it’s Permissions.
sudo chmod a-w /etc/ssh/sshd_config.original
Now edit the file.
sudo vi /etc/ssh/sshd_config
Make sure that you change PasswordAuthentication no to:
Then restart SSH for the changes to take effect.
sudo /etc/init.d/ssh restart
So now your user must enter this username and password, along with the IP address and they should be able to connect, if the security permissions are setup properly.