如何设置ssh的默认shell
要设置SSH的默认shell,您可以按照以下步骤进行操作:
-
登录到SSH服务器上的管理员帐户。
-
使用文本编辑器打开SSH服务器的配置文件。根据不同的Linux发行版,配置文件的位置可能会有所不同。一般而言,它位于/etc/ssh/sshd_config。
-
在配置文件中找到或添加以下行:
# Set default shell for new SSH connections
# This line specifies the default shell for all users connecting via SSH
# The default value is usually /bin/bash
# Change it to the desired shell (e.g., /bin/zsh or /bin/csh)
# Make sure the shell is installed on the system
# If a user has a specific shell set in /etc/passwd, that shell will be used instead
# If not set, the default shell specified here will be used
# If set to /usr/sbin/nologin or /bin/false, the user will not be allowed to login via SSH
# DefaultShell /bin/bash
-
将DefaultShell行的注释符号(#)删除,并将默认shell的路径修改为您想要的shell的路径。例如,将其修改为/bin/zsh或/bin/csh。
-
保存并关闭配置文件。
-
重新加载SSH服务器的配置,以使更改生效。可以使用以下命令之一来重新加载配置:
- 对于使用systemd的系统:
systemctl reload sshd - 对于使用init.d的系统:
/etc/init.d/sshd reload或/etc/init.d/ssh reload
- 现在,SSH的新连接将使用您指定的默认shell。
请注意,如果用户在/etc/passwd文件中有特定的shell设置,那么他们将使用该设置,而不是默认shell
原文地址: http://www.cveoy.top/t/topic/ivpF 著作权归作者所有。请勿转载和采集!