PSSH cannot execute the specified user command

Source: Internet
Author: User
Tags root access


A script (must be executed by the root user), can be run locally, and pssh-h ip_file "cd/home/byte/" cannot be executed.


The analysis should be that SSH does not get root permissions, possibly because there are multiple users in the operating system installation and the default remote user is non-rooted. By looking at the known SSH default login user is not root

Linux system setup involves two ways to start the shell one is to log on locally and the other is Telnet,

Local Direct Login shell terminal environment Call process is ~/.BASH_PROFILE->~/.BASHRC

SSH login directly call ~/.BASHRC, resulting in just a normal user login, not get root permissions


1. Modify the command to first execute root. bash_profile to get root privileges

Pssh-h ip_file "source/root/.bash_profile;cd/home/byte/"

2. Modify the. SSH configuration file

Vi/etc/.ssh/enviroment Add the required environment variables in the following format



such as adding user=root

and modify the Permituserenvironment=yes in the/etc/ssh/sshd_config file (which brings security issues, see note 1 link)

The next time you log in, you get root access.


1. Security issues

permituserenvironment             ~/.ssh/environment ~/.ssh/authorized_keys environment=
The default value is "no". Set to "Yes" may cause users to have the opportunity to bypass access control using certain mechanisms (such as ld_preload)

Reference Connection
2. Interpretation of relevant documents
/Bin/BashTheBash executable/etc/ProfileTheSystemwide initialization File,Executedfor login Shells~/.the personal initialization File executed for login Shells~/.the individual Per-interactive< Span class= "pun" >-shell startup File~/.the individual login shell cleanup File, executed when a login shell Exits~/.individual ReadLine initialization file

Reference: Http://


PSSH cannot execute the specified user command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.