Abh*_*tia 10 command-line fish etc chsh
关于如何将外壳更改为鱼的任何想法?
$ sudo usermod -s /usr/bin/fish jaan
usermod: user 'jaan' does not exist in /etc/passwd
$ getent passwd $USER
jaan:x:15466:94:Jaan A:/home/jaan:/bin/zsh
Run Code Online (Sandbox Code Playgroud)
相关问题:尝试更改默认shell时,/etc/passwd中不存在用户 似乎它使用了ldap。
$ cat /etc/nsswitch.conf
passwd: compat ldap
group: compat ldap
shadow: compat ldap
# Having the NOTFOUND=return bit was breaking dns resolution on web1 and web2. But we probably
# don't want any of the mdns stuff so let's get rid of it all.
#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: ldap
automount: ldap
Run Code Online (Sandbox Code Playgroud)
所以我安装了 ldap 相关的包。
$ chsh.ldap
LDAP password for jaan:
Enter the new value, or press ENTER for the default
Login Shell [/bin/zsh]: /usr/bin/fish
Traceback (most recent call last):
File "/usr/bin/chsh.ldap", line 69, in <module>
constants.NSLCD_USERMOD_SHELL: shell,
File "/usr/share/nslcd-utils/nslcd.py", line 128, in usermod
assert con.get_response() == constants.NSLCD_RESULT_BEGIN
File "/usr/share/nslcd-utils/nslcd.py", line 103, in get_response
return self.read_int32()
File "/usr/share/nslcd-utils/nslcd.py", line 71, in read_int32
return _int32.unpack(self.read(_int32.size))[0]
struct.error: unpack requires a string argument of length 4
$ which fish
/usr/bin/fish
$ chsh.ldap
LDAP password for jaan:
Enter the new value, or press ENTER for the default
Login Shell [/bin/zsh]: "/usr/bin/fish"
/usr/bin/chsh.ldap: "/usr/bin/fish" is an invalid shell
$ /usr/bin/fish
(standard_in) 1: syntax error
Welcome to fish, the friendly interactive shell
Run Code Online (Sandbox Code Playgroud)
这里有一个提示:/usr/bin/chsh.ldap: "/usr/bin/fish" is an invalid shell。看来你应该添加/usr/bin/fish到/etc/shells.
Max*_*Max -1
在这里引用阿杰米奇的话,
您可以通过运行 chsh -s 将 Fish 设置为默认 shell,
which fish然后注销并重新登录。(要将其设置回 bash,当然您需要使用 Fish 语法,例如 chsh -s (which bash))
只需使用chsh -s which fish并确保注销并重新登录或重新启动计算机。
顺便说一句,这可能是重复的:How do I set Fish as the default shell?