操作用户 简介

本文详细介绍了在Linux系统中创建、修改、删除用户账户的方法,包括设置密码、指定登录路径、选择登录shell、更改用户组、设置过期日期、更新用户信息、更改用户目录、设置用户权限等操作。
#view  user 
cut -d : -f 1 /etc/passwd

#add user test
useradd test
#add user test with new path :/home/newtest
useradd -d /home/newtest test
#add user test with same group
useradd -g admingroup test
#add user test with same groups
useradd -G admingroup,usergroups test
#add user test with login path:/www (default is ~) and login shell:/usr/bin/passwd (default is /bin/bash)
useradd -d /www -s /usr/bin/passwd test

#set password of test
passwd test

#delete user
userdel test

#set user shell
cat /etc/shell
    /bin/sh
    /bin/bash
    /sbin/nologin
    or other:
    /bin/bash2
    /bin/bsh
    /bin/tcsh
    /bin/csh
    /usr/bin/passwd
    /bin/false
    
#set test user shell,by root user
chsh test
#set test user shell 
usermod -s /bin/bash test
usermod -s "" test
#update test user 's group
usermod -g nobody test
#update test user 's exprie time:MM/DD/YY:2001-12-01
usermod -e 12/03/01 test
#update user info,between 4th and 5th :
vi /etc/passwd
    floatboat:x:503:503::/home/floatboat:/bin/bash
#update user home path
usermod -d /www/home test
usermod -d -m /www/home  test   #with data to trans.

touch tdfs
ls -l tdfs
-rw-rw-r-- 1 floatboat webusers 0 Feb 6 21:37 tdfs




转载于:https://my.oschina.net/iatbforever/blog/281580

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值