关注分享主机优惠活动
国内外VPS云服务器

如何使用Ubuntu Deluser配置SSH访问

Ubuntu Systems上,Deluser命令用于删除用户帐户。 如果要在删除用户时禁用SSH访问,则可以按照以下步骤操作:

打开终端。

使用Deluser命令删除用户。 For example, if you want to delete a user with a username, you can use the following command:

sudo deluser username

If you want to delete the user's home directory and remove the email spool, then -remove-home and-remove-mail spool options:

[he] sudrume-make-amemak username

禁用用户的SSH权限。这可以通过编辑/etc/ssh/sshd_config文件来完成。 例如,使用纳米编辑器使用文本编辑器打开文件:

sudo nano/etc/sssh/ssh/sshd_config

在sshd_config文件中,请找到线的公差。 如果此行不存在,则可以将其添加到文件末尾。 该行列出了将通过SSH授予系统访问权限的用户。 每个用户名必须占据一行。 例如,

允许使用者user1 user2 user2 user3

如果要禁止某些用户通过SSH访问,请确保您的用户名不在此列表中。

保存并关闭SSHD_CONFIG文件。

重新启动SSH服务以应用更改。

如果要禁用用户的SSH访问而不是删除用户,请注意,使用USERMOD命令可以将用户的外壳更改为 /sbin /nolologin或 /nolologin或 /bin /false。 例如,

sudo usermod -s/sbin/nologin用户名

这会阻止用户登录通过SSH登录,但保留了系统上的其他访问权限。 如果要永久删除用户,请按照上述步骤操作。

以上内容来自互联网,并不代表本网站的所有视图! 关注我们:zhujipindao .com

未经允许不得转载:主机频道 » 如何使用Ubuntu Deluser配置SSH访问

评论 抢沙发

评论前必须登录!