I was wondering how to execute a command file where: After logging in as a standard user, I want to switch user to "username" with password being "password", I can successfully execute the command.txt using a batch file by testing echo.

However, I have no clue how to include the password in the command file which is executed by a batch file when trying to switch user.

P.S This is when I am already inside the SSH session as a standard user.

  • Do you have administrative access to the server? – Andy Mar 1 '15 at 8:40

Use the su command followed by the username

  • you will be asked to enter the password of the user you input and then you will serve active as that user – Dbo Feb 26 '15 at 2:33
  • I am talking about authentication without needing user intervention like specifying password and username in the command file so that user don't need to input anything to switch user. For example: Logging into an SSH session can be something like: putty.exe "IP_ADDRESS" -l User_name -pw Password. Because my server requires me to log into a standard user first before switching user to the root user, I want to automate this process. I have done the automating of logging into the session but I don't know how to do the same when switching user in the session. – Prakoso Feb 26 '15 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.