在CentOS上设置Telnet用户权限,您需要按照以下步骤操作:
sudo yum install telnet-server
sudo systemctl start telnet.socket
sudo systemctl enable telnet.socket
your_username替换为您选择的用户名):sudo adduser your_username
sudo passwd your_username
/etc/securetty文件,将不允许Telnet访问的终端设备删除或注释掉。例如,如果您只想允许用户从本地计算机访问Telnet服务,可以删除或注释掉除tty1之外的所有设备。sudo vi /etc/securetty
/etc/passwd文件,将用户的默认shell更改为/sbin/nologin或其他不允许登录的shell。例如:sudo vi /etc/passwd
找到您的用户行(例如your_username:x:1001:1001::/home/your_username:/bin/bash),将其更改为:
your_username:x:1001:1001::/home/your_username:/sbin/nologin
保存更改并退出编辑器。
重新启动Telnet服务以应用更改:
sudo systemctl restart telnet.socket
现在,您已经成功设置了CentOS上的Telnet用户权限。只有经过授权的用户才能访问Telnet服务,并且他们将无法登录到shell。