【问题标题】:How to escape the `su -arch`?如何逃脱`su -arch`?
【发布时间】:2016-08-28 07:40:18
【问题描述】:

我分配了一个帐户名称arch

useradd -m -G users  arch
passwd arch

现在使用命令su -arch su 进入arch。

如何通过某种转义方法su进入账户名arch

【问题讨论】:

  • 使用:su - arch

标签: bash su


【解决方案1】:

我认为混乱是因为您可以使用 root 登录

su - # There are no options in this case and the default login is root

但你不应该这样做

su -arch #Anything the follows is an option

由于a 不是一个有效的选项,你得到了一个错误

正确的方法可能是下面的任何人

su arch 
su - arch # mind the space
su -- arch # The -- marks the end of options, gives way for non-options arguments

【讨论】:

    【解决方案2】:

    您可以通过以下几种方式使用登录 shell 进行 su 操作

    su - arch
    su -l arch
    su --login arch
    

    问题是使用以下命令处理选项 - 没有 su -a 选项

    su -arch
    

    【讨论】:

      猜你喜欢
      • 2019-09-21
      • 1970-01-01
      • 1970-01-01
      • 2017-10-31
      • 2016-02-11
      • 1970-01-01
      • 2016-03-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多