美文网首页
Linux命令

Linux命令

作者: 潇Shawn纹 | 来源:发表于2017-03-18 11:27 被阅读0次

Linux命令

@(存笔记)

Linux、Unix、Mac等常用命令

创建用户

  • Ubuntu
    root用户密码
sudo passwd root # 给初始无密码的root用户设置密码

创建/删除普通用户

# root用户权限下
adduser username # 创建用户 username
userdel username # 删除用户
rm -rf /home/username # 删除用户主目录,否则新建同名用户不能使用旧的/home/username目录

赋予root权限,作如下修改

vim /etc/sudoers
# User privilege specification
root ALL=(ALL) ALL
username ALL=(ALL) ALL

发布密钥登陆,要确认/etc/ssh/sshd_config中密码登陆是否打开。

 ssh-copy-id -i id_rsa.pub username@host # 必须要用rsa密钥

如果要禁用密码登陆,修改/etc/ssh/sshd_config文件,把允许密码验证这一行改为no:

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no

禁止部分用户密码登陆,可以使用passwd -l username命令锁定密码。
改命令不建议给非root用户使用,否则在使用sudo权限时,无法输入密码。

相关文章

网友评论

      本文标题:Linux命令

      本文链接:https://www.haomeiwen.com/subject/vteunttx.html