Question

How can I allow SFTP connections with SSH keys only on Ghost one click install app server?

I have SSH keys setup for access for root and the one regular user I added.

I would like to:

Disable remote root login of any kind.

Allow user1 to sudo without password once logged in via SSH keys.

Disallow remote logins of any kind without SSH keys (disable password use completely).

Allow SFTP connections with SSH keys only.

Can anyone help by telling em the steps I have to take?

This app install runs Ubuntu 14.04

Thanks.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Here is the answer without thousands of words and external links in three simple steps.

Add the line below to /etc/sudoers

username ALL=(ALL) NOPASSWD:ALL

Edit /etc/ssh/sshd_config and change (and uncomment if necessary) the line, default is probably ‘yes’:

PermitRootLogin no

Also edit/change/uncomment:

PasswordAuthentication no 

The tutorial Initial Server Setup with Ubuntu 14.04 will walk you through creating a non-root accout with SSH keys and disabling SSH access completely for the root account. Since SFTP uses SSH, once you’ve set that up, SFTP access will also be disabled for the root user.

That should point you in the right direction. Let us know if you run into any problems!