Forum Moderators: phranque

Message Too Old, No Replies

SFTP without root user

         

optik

11:20 am on Jul 14, 2010 (gmt 0)

10+ Year Member



I'm taking steps to remove the root user fro SSH for security purposes but have come across a stumbling block, I use SFTP do do a lot o maintenance, such as downloading logs, edit config files, installing packages such as awstats.

While I can sudo to root using the command line when using SFTP I am restricted only to the folder of the user I log in with.

Is there anyway to grant the new user more privileges to get full access to the server with SFTP?

This is on Linux.

lammert

7:19 am on Jul 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Removing the SSH ability of the root user is a good step to increase protection. The larger part of the SSH login attacks use the root user account as target.

You may indeed run into problems because general users don't have as much rights as the root user and you may be therefore not be able to do as much as you could do under the root account. If you are logged in as a regular user with SSH (not SFTP), you can get full root privileges with the su - command.

This command asks for the root password and if that succeeds gives you a shell which allows equivalent access as what you had when you logged in with SSH directly as root user.

The su command in general is used to switch the shell privileges from one user account to another, whereas the sudo command is more appropriate to execute one single command with higher privileges.

Please not that I typed su - and not su to get access to the full root level. The "-" ensures that the login scripts are executed, setting all the necessary environments variables, the PATH to the root-user utilities etc.

optik

8:19 am on Jul 16, 2010 (gmt 0)

10+ Year Member



I've got sudo running now and am getting used to the whole thing, I can use vim for editing config files and can still download logs with my new user from anywhere on the system, installation can be done with RPM so I should be fine.

Going to run both users for a bit until I am totally used to this way of admin.