linux 添加用户并设置主目录,shell 并赋予权限 (以 fedora 和 ubuntu 为例); linux 添加用户管理员权限;

添加用户:

[root@localhost ~]# useradd -d /home/yaowen -m -s /bin/bash yaowen

更改用户密码:

passwd yaowen

查看当前组:

groups

id

删除用户:

 [root@localhost /]# userdel -r username

修改默认shell:

cat /etc/shells

chsh -s /bin/bash 

usermod -s /bin/zsh user

环境 centos 7.6, 添加管理员权限:(2022-01-04 更新)

sudo adduser -g wheel username # 添加有管理员权限用户

sudo usermod -G wheel username # 追加管理员权限

ubuntu 添加赋予管理员权限:(2019.10.14 更新)

sudo usermod -a -G adm new_username

sudo usermod -a -G sudo new_username

sudo usermod -a -G docker new_username # 容器管理员,2021年12月29日16:32:28

使用效果:(2022-01-04 17:24:26)

 

## ipmi 设置 2023年03月30日13:18:58:

安装工具:

apt-get install -y ipmitool
或者: yum install -y ipmitool

BMC配置命令:
ipmitool lan print 1 #打印当前ipmi 地址配置信息。
ipmitool lan set 1 ipsrc static # 设置 id 1 为静态IP地址。
ipmitool lan set 1 ipaddr 10.42.223.71 # 设置 IPMI 地址。
ipmitool lan set 1 netmask 255.255.255.0 # 设置 IPMI 子网掩码。
ipmitool lan set 1 defgw ipaddr 10.42.223.254 # 设置 IPMI 网关。
修改用户名: ipmitool user list
1 # 显示 IPMI 用户列表。 ipmitool user set name 2 root #创建用户,一般服务器有默认的超级用户(root,admin,ADMIN), 可以直接修改超级用户的密码,不用重新创建。 ipmitool user set password 2 calvin #创建密码 ipmitool channel setaccess 1 2 callin=on link=on privilege=4 #开权限 ipmitool user list 1 # 查看chanenel1的用户信息 ipmitool user set password 1 abc-123 # 修改用户 id1 的密码 为 abc-123

启动用户:
ipmitool user enable 3 # 启动用户;2023-05-09

相关博客链接:

https://www.cnblogs.com/xuyaowen/p/get-group-id.html

https://www.cnblogs.com/xuyaowen/p/linux-chsh.html 

posted @ 2019-07-09 18:30  Michael-Xu  阅读(7049)  评论(0编辑  收藏  举报