给某个特定的用户授予某个特定文件夹的权限:

  • setfacl -m u:user1:rwx accounts
  • setfacl -m u:user2:rwx accounts
  • setfacl -m other:--- accounts
  • getfacl accounts: 获取accounts文件夹的权限

删除用户的口令

passwd -d user2

对访问权限进行备份

getfacl -R /example > permissions.acl 恢复这些文件的权限配置 setfacl -- restore=permisions.acl

查看最近的某用户账号的登录信息

last

限制某个用户登录

usermod -s /usr/sbin/nologin user1

锁定用户user1,使其无法登录

passwd -l user1

再次查看/etc/shadow中user1的信息,即变成以!开逆流而上的不合法的值了

cat /etc/shadow | grep user1

解锁该账号

passwd -u user1

查看某个账号是否被锁定

passwd -S user1:L表示 被锁定,P表示没有锁定

锁定某个账号

usermod -L user1

解锁某个账号

usermod -P

user2以user1的身份执行ps命令

sudo -u user1 ps

vim /etc/sudoers

user2 ALL=(user1)NOPASSWD: /bin/ps

假使要使user1账号拥有user2和user3口令的权限
vim /etc/sudoers
user1 ALL=/usr/bin/passwd user2,/usr/bin/passwd user3

基于ssh远程访问的安全性

生成密钥对

ssh-keygen-t rsa:保存在〜./ssh/中,

复制到远程服务器上

ssh-copy-id -p 22 ip

验证

ssh remoteIP

利用sftp复制文件

sftp remoteIP
ls
get sample.txt /home/tajinder/desktop