How do I automatically gain root access with Putty?
34,894
In putty: On the Connection > Data page, you can set an auto login username, and
On the Connection > SSH page, you can set a remote command such as sudo -i
or sudo su -
If you don't ever want to have to type your password once, set up your ssh keys.
Author by
melanie
Updated on September 18, 2022Comments
-
melanie over 1 year
Putty is set up to run like:
putty.exe -load mysession -l myuser -pw mypass
But it logs me in as
myuser
. For root access I need to type in the console:sudo -i
Then it asks for my password again.
Is there a way to automate this in Putty, so I don't have to type
sudo -i
and the password ? I'd like to have root access on startup by default.-
melanie almost 11 yearsNope. I think it's because root doesn't have a password, so whatever I enter it appears to be incorrect
-
kmort almost 11 yearsGood Idea: give root a password (use
passwd root
). Bad Idea:, make sure root has SSH permission usingssh_config
. See cyberciti.biz/faq/allow-root-account-to-use-ssh-openssh , but realize this makes your system insecure. -
melanie almost 11 yearsThis is just for a local dev server on my PC. I don't really care about security
-
melanie almost 11 yearshey thanks, I've set up a password for root, and now I can log in automatically with the command you suggested above :)
-
-
melanie almost 11 yearsThanks. I've managed to set public keys and stuff, added that remote command, but it still asks for my password to gain root access
-
Hurricane Hamilton almost 11 yearsWeird. I don't have keys set up in my instance of putty, so I did have to type in my password once, but once I typed it in (for login auth) it just dumped me to a root console, with the
#
prompt. I wonder where the difference comes from. same version of Ubuntu too. odd.