How to login with the accout root directly after run your script


#1

How to login with the accout root directly after run your script?
I found that I must login with other user then type su.
I want to login root directly
thanks


#2

If running Debian/Ubuntu - this might be helpful: http://askubuntu.com/questions/511833/cant-ssh-in-as-root

However - I’m no Linux expert, but an avid Googler - so use with caution :slight_smile:


#3

This is a default prevention by the OS. You will need to edit your sshd_config file to PermitRootLogin

Go to /etc/ssh/sshd_config and change the following line:

PermitRootLogin without-passwd

to:

PermitRootLogin yes

then restart ssh by typing service ssh restart


#4

Personally, I’d leave that there and just setup the passwdless ssh, it’ll let you in as root without that change and is more secure than opening up the ssh to allow the root password. There is a reason its without-passwd.


#5

It’s true, however, this is solely user preference. We have a guide that can be followed to accomplish what @RXWatcher is referring to.