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
[code]sudo useradd -d /home/sublet -m sublet[/code]
Then I need to set a password.
[code]sudo passwd sublet[/code]
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.
[code]sublet ALL=(ALL) ALL[/code]
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.
[code]sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original[/code]
Set it’s Permissions.
[code]sudo chmod a-w /etc/ssh/sshd_config.original[/code]
Now edit the file.
[code]sudo vi /etc/ssh/sshd_config[/code]
Make sure that you change PasswordAuthentication no to:
Then restart SSH for the changes to take effect.
[code]sudo /etc/init.d/ssh restart[/code]
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.