Friday, December 23, 2016

Root user Session in MobaXterm

Root user Session in MobaXterm 


If your account on linux system has root permissions, then you can use this privilege to create a new session on MobaXterm directly as a root user without entering roots password. Why would you need new session directly as root user? This you may need some times, so you can work as root user on files from SFTP or use other tools of  MobaXterm.

Here are steps to create a Mobaxterm session as root user without entering root's password.

Steps:
ssh to remote linux machine from MobaXterm with your user. Then swicth to root session.
sudo su

Create private and public keys, using following command:
ssh -keygen -t rsa
          (don’t provide file names or passwords at prompts)

This will create keys id_rsa and id_rsa.pub in ~/.ssh folder

Create file named authorized_keys in ~/.ssh (ignore if already exists, this file should have 600 permissions)

        
         Append public key (id_rsa.pub) contents to authorized_keys file.
           
            cp ~/.ssh/authorized_keys ~/.ssh/authorized_keys_bak
            cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys


copy private key (id_rsa) to your local machine (This is private key so save it in secure location)

Now create new session in MobaXterm with following settings in Basic ssh: 

  • Provide Remote host name
  • Check ‘Specify user name’ (value : root)
  • Under Advanced Ssh settings tab, select use private key and provide location of Private key.
  • Under Bookmarks Setting: give relevant server name 

Now you are ready to login to remote server with above bookmarked session as root user without entering password for root user.