要自定义 CentOS 上的 SFTP 提示信息,您需要修改 OpenSSH 服务器的配置文件
/etc/ssh/sshd_config 文件。例如,使用 nano 编辑器:sudo nano /etc/ssh/sshd_config
Banner /etc/ssh/banner.sftp
这告诉 SSH 服务器在用户登录时显示 /etc/ssh/banner.sftp 文件中的内容。
/etc/ssh/banner.sftp 文件:sudo nano /etc/ssh/banner.sftp
banner.sftp 文件中输入您想要显示的自定义提示信息。例如:Welcome to the SFTP server!
Please read the following rules carefully:
1. Do not share your account with others.
2. Do not attempt to access files or directories that you do not have permission to access.
3. Violation of these rules may result in termination of your account.
保存并关闭文件。
重新启动 SSH 服务以使更改生效:
sudo systemctl restart sshd
现在,当用户通过 SFTP 登录时,他们将看到您自定义的提示信息。请注意,这些更改仅适用于使用 SFTP 的用户,而不是通过 SSH 访问系统的用户。