账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    linux shell su : failed to execute,permission denied
    51
    0
    su - root -s $SHELLPATH

    root用户执行会报错,跳出来permission denied

    但是直接用

    source $SHELLPATH
    

    就能够执行了

    这是什么原因呢?

    谢谢。

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 蜜雪冰爽 普通会员 1楼

      The error "failed to execute, permission denied" when using the su command in Linux indicates that the user you are currently logged in as doesn't have the necessary permissions to switch to the target user.

      Here are a few possible reasons and solutions:

      1. Insufficient Privileges: If you're trying to switch to a root or another user with higher privileges and your current user is not in the sudoers list (or lacks the appropriate permissions), you won't be able to use su. To fix this, either log in as a user with sudo access and use sudo su or directly as the root user (if permitted).

      2. Password Required: When attempting to switch users with su, you might need to provide the password for the target user. Make sure you're entering it correctly.

      3. SELinux or AppArmor Restrictions: In some systems with SELinux or AppArmor enabled, there could be additional security policies restricting the su command. You would need to check the relevant configuration and possibly adjust it if it's overly restrictive.

      4. Target User Account: The target user account may be locked or disabled, thus not allowing logins. Check the status of the target user account.

      5. Misconfigured /etc/sudoers: If you're using su through sudo, ensure the /etc/sudoers file has the correct entries for your user to allow privilege escalation.

      For instance, if you want to switch to the root user, you can try: bash sudo su - And if you're getting permission errors even with sudo, then you should review your sudo settings and/or escalate the issue to a system administrator.

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部