小编Ass*_*lov的帖子

哪个 bash 正在执行?

我想我已经将 bash 配置为 shell,但为什么会发生这种情况?

我的外壳是 bash:

# ls -al `which sh`
  lrwxrwxrwx 1 root root 4 Jul 12 03:25 /bin/sh -> bash 
Run Code Online (Sandbox Code Playgroud)

使用 sh 执行脚本时出错

# sh ubuntu/util.sh
  ubuntu/util.sh: line 32: `test-build-release': not a valid identifier
Run Code Online (Sandbox Code Playgroud)

bash 没有错误

# bash ubuntu/util.sh
Run Code Online (Sandbox Code Playgroud)

shell bash

5
推荐指数
1
解决办法
1301
查看次数

为什么我不能以 /bin/false 作为登录 shell 的用户身份运行命令?

我附加到已经使用此命令创建用户的 docker 映像:

RUN useradd -r -u 200 -m -c "nexus role account" -d /nexus-data -s /bin/false nexus
Run Code Online (Sandbox Code Playgroud)

我想以该用户身份运行命令,但什么也没发生。试图解决这个问题,我发现我无法使用 /bin/false 作为登录名的用户运行任何东西:

# useradd xxx
# su xxx -c 'ls >>/t/t1'
# ls /t
t1
# useradd -s /bin/false
# su xxx1 -c 'ls >>/t/t2'
# ls /t
t1
Run Code Online (Sandbox Code Playgroud)

我原以为在没有-. 我用谷歌搜索,我发现如果我添加-s /bin/bash,我可以运行命令,但为什么会这样?该-选项是su的意思是“使用登录shell”,为什么是登录shell相关的不-

shell login su

2
推荐指数
1
解决办法
1225
查看次数

标签 统计

shell ×2

bash ×1

login ×1

su ×1