6--usermod命令使用手册
usermod命令使用手册
1 作用
usermod命令用于修改用户的基本信息。
usermod命令不允许你改变正在线上的使用者帐号名称。
当usermod命令用来改变user id,必须确认这名user没在电脑上执行任何程序。
你需手动更改使用者的crontab档。
也需手动更改使用者的at工作档。
采用NIS server须在server上更动相关的NIS设定。
2 语法
Usermod[选项][参数]
参数
登录名:指定要修改信息的用户登录名。
3 常用选项
-c<备注>:修改用户帐号的备注文字;
-d<登入目录>:修改用户登入时的目录;
-e<有效期限>:修改帐号的有效期限;
-f<缓冲天数>:修改在密码过期后多少天即关闭该帐号;
-g<群组>:修改用户所属的群组;
-G<群组>;修改用户所属的附加群组;
-l<帐号名称>:修改用户帐号名称;
-L:锁定用户密码,使密码无效;
-s:修改用户登入后所使用的shell;
-u:修改用户ID;
-U:解除密码锁定。
4 实例
1 将newuser2添加到组staff中:
[root@localhost ~]#usermod -G staff newuser2
2 修改newuser的用户名为newuser1:
[root@localhost ~]#usermod -l newuser1 newuser
3 锁定账号newuser1:
[root@localhost ~]#usermod -L newuser1
4 解除对newuser1的锁定:
[root@localhost ~]#usermod -U newuser1
5 更改登录目录
[root@localhost ~]#usermod -d /home/hnlinux root
6 改变用户的uid
[root@localhost ~]#usermod -u 777 root。
维护用户账户-usermod命令
维护用户账户-usermod命令一、usermod命令的作用usermod命令用来修改用户帐号的各项设定二、usermod命令的语法usermod [-LU][-c <备注>][-d <登入目录>][-e <有效期限>][-f <缓冲天数>][-g <群组>][-G <群组>][-l <帐号名称>][-s <shell>][-u <uid>][用户帐号]三、usermod命令的参数-c<备注>:修改用户帐号的备注文字;-d<登入目录>:修改用户登入时的目录;-e<有效期限>:修改帐号的有效期限;-f<缓冲天数>:修改在密码过期后多少天即关闭该帐号;-g<群组>:修改用户所属的群组;-G<群组>;修改用户所属的附加群组;-l<帐号名称>:修改用户帐号名称;-L:锁定用户密码,使密码无效;-s<shell>:修改用户登入后所使用的shell;-u<uid>:修改用户ID;-U:解除密码锁定。
四、usermod命令实例(一)修改用户的UID设置用户user1,指定其UID为600,命令格式为usermod -u 600 user1。
执行命令后,在/etc/passwd文件中可以查看到,在第3字段,user1用户的UID 已经被设置为600。
(二)修改用户的主目录在新建user2用户时,系统默认指定的主目录为/home/user2。
我们要将user2用户的主目录修改为/home/dir ,其命令格式为usermod -d /home/dir user2。
执行命令后,在/etc/passwd文件中可以查看到,在第5字段,可以看到user2用户的主目录已经修改成功。
(三)修改用户所属的用户组设置用户user3所属的用户组为user2用户组。
DirectSOFT6软件用户手册说明书
1-4
DirectSOFT6 User Manual, 2nd Ed. Rev. B
Conventions Used
Байду номын сангаас
Chapter 1: Introduction
When the “notepad” symbol is shown in the left-hand margin, the paragraph to its immediate right will be a special note. The word NOTE: in boldface will mark the beginning of the text.
Supplemental Manuals
Depending on the products you have purchased, there may be other manuals that are necessary to use for your application. User Manuals
When the “exclamation mark” symbol is shown in the left-hand margin, the paragraph to its immediate right will be a warning. This information could prevent injury, loss of property, or even death (in extreme cases). The word WARNING: in boldface will mark the beginning of the text.
See the chart below for the PLCs and the supporting firmware revisions required for the new IBox instructions.
Linux用户管理命令大全
Linux⽤户管理命令⼤全1、添加⽤户,⾸先⽤adduser命令添加⼀个普通⽤户,命令如下:$ adduser tommy//添加⼀个名为tommy的⽤户$ passwd tommy //修改密码Changing password for user tommy.New UNIX password: //在这⾥输⼊新密码Retype new UNIX password: //再次输⼊新密码passwd: all authentication tokens updated successfully.2、赋予root权限⽅法⼀:修改 /etc/sudoers ⽂件,找到下⾯⼀⾏,把前⾯的注释(#)去掉## Allows people in group wheel to run all commands%wheel ALL=(ALL) ALL然后修改⽤户,使其属于root组(wheel),命令如下:usermod -g root tommy修改完毕,现在可以⽤tommy帐号登录,然后⽤命令 su – ,即可获得root权限进⾏操作。
⽅法⼆:修改 /etc/sudoers ⽂件,找到下⾯⼀⾏,在root下⾯添加⼀⾏,如下所⽰:Allow root to run any commands anywhereroot ALL=(ALL) ALLtommy ALL=(ALL) ALL修改完毕,现在可以⽤tommy帐号登录,然后⽤命令 sudo – ,即可获得root权限进⾏操作。
⽅法三:修改 /etc/passwd ⽂件,找到如下⾏,把⽤户ID修改为 0 ,如下所⽰:tommy:x:0:33:tommy:/data/webroot:/bin/bash⼀、Linux系统⽤户账号的管理⽤户账号的管理⼯作主要涉及到⽤户账号的添加、修改和删除。
添加⽤户账号就是在系统中创建⼀个新账号,然后为新账号分配⽤户号、⽤户组、主⽬录和登录Shell等资源。
linuxusermod命令参数及用法详解(linux修改用户账号信息命令)
linuxusermod命令参数及⽤法详解(linux修改⽤户账号信息命令)命令:usermod功能说明:修改⽤户帐号。
语 法:usermod [-LU][-c <备注>][-d <登⼊⽬录>][-e <有效期限>][-f <缓冲天数>][-g <群组>][-G <群组>][-l <帐号名称>][-s<shell>][-u <uid>][⽤户帐号]补充说明:usermod可⽤来修改⽤户帐号的各项设定。
参 数: -c<备注> 修改⽤户帐号的备注⽂字。
-d登⼊⽬录> 修改⽤户登⼊时的⽬录。
-e<有效期限> 修改帐号的有效期限。
-f<缓冲天数> 修改在密码过期后多少天即关闭该帐号。
-g<群组> 修改⽤户所属的群组。
-G<群组> 修改⽤户所属的附加群组。
-l<帐号名称> 修改⽤户帐号名称。
-L 锁定⽤户密码,使密码⽆效。
-s<shell> 修改⽤户登⼊后所使⽤的shell。
-u<uid> 修改⽤户ID。
-U 解除密码锁定。
usermod 不允许你改变正在线上的使⽤者帐号名称。
当 usermod ⽤来改变 user ID, 必须确认这名 user 没在电脑上执⾏任何程序。
你需⼿动更改使⽤者的 crontab 档。
也需⼿动更改使⽤者的 at ⼯作档。
采⽤ NIS server 须在 server 上更动相关的 NIS 设定。
应⽤举例:1、将 newuser2 添加到组 staff 中# usermod -G staff newuser22、修改 newuser 的⽤户名为 newuser1# usermod -l newuser1 newuser3、锁定账号 newuser1# usermod -L newuser14、解除对 newuser1 的锁定# usermod -U newuser1。
网络用户管理实验报告(3篇)
第1篇一、实验目的本次实验旨在让学生了解网络用户管理的概念、方法和技术,掌握Linux系统中用户和用户组的管理方法,熟悉图形界面和命令行界面操作,并能根据实际需求进行用户和用户组的管理,提高网络管理员的工作效率。
二、实验环境1. 操作系统:Linux2. 网络设备:路由器、交换机、PC等3. 实验软件:Linux操作系统、网络管理工具等三、实验内容1. 用户和用户组的概念用户:在Linux系统中,用户是指可以登录系统并使用系统资源的实体。
每个用户都有一个唯一的用户名和密码,以及对应的UID(用户标识符)。
用户组:用户组是一组具有相同权限的用户集合。
每个用户可以属于一个或多个用户组,通过用户组可以简化权限管理。
2. 用户和用户组的管理方法(1)图形界面管理1)登录Linux系统,进入图形界面。
2)打开“系统管理”菜单,选择“用户和组”。
3)在用户和组管理界面,可以查看、添加、删除、修改用户和用户组。
(2)命令行界面管理1)登录Linux系统,进入命令行界面。
2)使用以下命令进行用户和用户组的管理:a. 添加用户:`useradd [选项] 用户名`b. 删除用户:`userdel [选项] 用户名`c. 修改用户密码:`passwd [选项] 用户名`d. 查看用户信息:`id [选项] 用户名`e. 添加用户组:`groupadd [选项] 组名`f. 删除用户组:`groupdel [选项] 组名`g. 查看用户组信息:`groupmod [选项] 组名`3. 实验步骤(1)在Linux系统中创建一个名为“testuser”的新用户,并设置密码。
(2)将“testuser”添加到“testgroup”用户组中。
(3)修改“testuser”的密码。
(4)查看“testuser”和“testgroup”的信息。
(5)删除“testuser”和“testgroup”。
四、实验结果与分析1. 成功创建了名为“testuser”的新用户,并设置了密码。
usermod的用法
usermod的用法usermod的用法简介usermod是一个用于修改用户账户的命令行工具。
它允许管理员通过命令对用户账户进行各种修改,包括修改用户名、用户组、主目录、登录 shell 等。
用法示例以下是usermod的一些常见用法示例:1.修改用户名:$ usermod -l <new_username> <username>该命令将用户<username>的用户名修改为<new_username>。
2.修改用户组:$ usermod -g <new_group> <username>该命令将用户<username>的所属用户组修改为<new_group>。
3.添加用户到附加组:$ usermod -G <additional_group> <username>该命令将用户<username>添加到附加组<additional_group>中。
4.修改主目录:$ usermod -d <new_home_directory> <usernam e>该命令将用户<username>的主目录修改为<new_home_directory>。
5.修改登录 shell:$ usermod -s <new_shell> <username>该命令将用户<username>的登录 shell 修改为<new_shell>。
6.强制用户修改密码:$ usermod -p <password> <username>该命令将用户<username>的密码修改为<password>(应该是已经经过加密的密码)。
7.锁定用户账号:$ usermod -L <username>该命令将用户<username>的账号锁定,禁止其登录系统。
useradd、userdel和usermod命令
linux useradd 命令详解useradd 添加用户或更新新创建用户的默认信息1、创建用户的同时指定家目录 # useradd –d /benet/hq hq2、修改用户名 #usermod -l new_name ole_name3、在建立用户时指定用户组 # adduser -g class1 st034、更改用户的组帐号 # usermod -g class1 st015、设置帐户的有效期 # usermod -e 2006-04-01 st01 //e=expire-c comment 描述新用户帐号,通常为用户全名,comment 为字符串。
-c<备注> 加上备注文字。
备注文字会保存在passwd的备注栏位中。
-d home_dir 设置用户主目录,<登入目录> 指定用户登入时的启始目录,默认值为用户的登录名,并放在/home目录下。
-D创建新帐号后保存为新帐号设置的默认信息。
-e expire_date 指定帐号的有效期限,用 MM/DD/YYYY 格式设置帐号过期日期。
-f inactivity <缓冲天数> 指定在密码过期后多少天即关闭该帐号。
设置口令失效时间,该值为 0 使口令失效后帐号立即失效,为 -1 使该选项失效。
当值为 -1 时则关闭此功能。
预设值为 -1。
-g group 指定用户所属的群组。
group为组名。
-G group,[...] 定义使用者为一堆 groups 的成员。
每个群组使用 ??区格开来,不可以夹杂空白字元。
群组名同 -g 选项的限制。
如果使用者现在的群组不再此列,则将使用者由该群组中移除。
-k skel_dir 设置框架目录,该目录包含用户的初始配置文件,创建用户时该目录下的文件都被复制到用户主目录下。
-l login_name 变更使用者 login 时的名称为 login_name 。
其于不变。
特别是,使用者目录名应该也会跟着更动成新的登入名。
usermod命令使用说明
usermod命令使⽤说明1、命令概述usermod命令⽤于修改⽤户的基本信息。
usermod命令不允许改变正在线上的使⽤者帐号名称。
当usermod命令⽤来改变user id,必须确认这名user没在执⾏任何程序。
2、命令语法usermod【选项】【⽤户名】3、命令选项-u:修改⽤户的UID-g:修改⽤户所属的基本组-G:修改⽤户附加族,使⽤逗号隔开多个附加组,覆盖原有的附加组-a:追加更多的附加组,必须和-G使⽤,-aG追加附加组-md:家⽬录迁移,必须和-d⼀起使⽤,移动⽤户的家⽬录到新的位置-d:指定⽤户的家⽬录新位置(单独使⽤⽆意义)-c:修改⽤户的注释信息-s:更改⽤户使⽤的shell-l:更改⽤户登录名-L:锁定⽤户-U:解锁⽤户-e<有效期限>:修改帐号的有效期限;-f<缓冲天数>:修改在密码过期后多少天即关闭该帐号;4、命令⽰例4.1 -c修改⽤户备注信息:[root@lzg ~]# tail -1 /etc/passwdJerry:x:5003:5003::/home/Jerry:/bin/bash[root@lzg ~]# usermod -c jerry Jerry[root@lzg ~]# tail -1 /etc/passwdJerry:x:5003:5003:jerry:/home/Jerry:/bin/bash4.2 -d修改⽤户家⽬录:[root@lzg ~]# tail -1 /etc/passwdJerry:x:5003:5003:jerry:/home/Jerry:/bin/bash[root@lzg ~]# mkdir /home/jerry[root@lzg ~]# usermod -d /home/jerry/ Jerry[root@lzg ~]# tail -1 /etc/passwdJerry:x:5003:5003:jerry:/home/jerry/:/bin/bash4.3 -g修改⽤户所属群组:[root@lzg ~]# tail -1 /etc/passwdJerry:x:5003:5003:jerry:/home/jerry/:/bin/bash[root@lzg ~]# usermod -g 5002 Jerry[root@lzg ~]# tail -1 /etc/passwdJerry:x:5003:5002:jerry:/home/jerry/:/bin/bash。
usermod_FEDORA_LINUX_命令解析
NAMEusermod − modify a user accountSYNOPSISusermod[options]LOGINDESCRIPTIONThe usermod command modifies the system account files to reflect the changes that are specified on the command line.OPTIONSThe options which apply to the usermod command are:−a,−−appendAdd the user to the supplementary group(s). Use only with the−G option.−c,−−comment COMMENTThe new value of the user´s password file comment field. It is normally modified using the chfn(1)utility.−d,−−home HOME_DIRThe user´s new login directory.If the−m option is given, the contents of the current home directory will be moved to the new homedirectory,which is created if it does not already exist.−e,−−expiredate EXPIRE_DATEThe date on which the user account will be disabled. The date is specified in the formatYYYY−MM−DD.−f,−−inactive INACTIVEThe number of days after a password expires until the account is permanently disabled.A value of 0 disables the account as soon as the password has expired, and a value of −1 disables thefeature.−g,−−gid GROUPThe group name or number of the user´s new initial login group. The group must exist.−G,−−groups GROUP1[,GROUP2,...[,GROUPN]]]A list of supplementary groups which the user is also a member of. Each group is separated from thenext by a comma, with no intervening whitespace. The groups are subject to the same restrictions asthe group given with the−g option.If the user is currently a member of a group which is not listed, the user will be removed from thegroup. This behaviour can be changed via the−a option, which appends the user to the currentsupplementary group list.−l,−−login NEW_LOGINThe name of the user will be changed from LOGIN to NEW_LOGIN.Nothing else is changed. Inparticular,the user´s home directory name should probably be changed manually to reflect the newlogin name.−L,−−lockLock a user´s password. This puts a ´!´ in front of the encrypted password, effectively disabling thepassword. You can´t use this option with−p or−U.Note: if you wish to lock the account (not only access with a password), you should also set theEXPIRE_DATE to1.−m,−−move−homeMove the content of the user´s home directory to the new location.This option is only valid in combination with the−d(or−−home)option.−o,−−non−uniqueWhen used with the−u option, this option allows to change the user ID to a non−unique value.−p,−−password PASSWORDThe encrypted password, as returned by crypt(3).Note:This option is not recommended because the password (or encrypted password) will be visibleby users listing the processes.You should make sure the password respects the system´s password policy.−s,−−shell SHELLThe name of the user´s new login shell. Setting this field to blank causes the system to select thedefault login shell.−u,−−uid UIDThe new numerical value of the user´s ID.This value must be unique, unless the−o option is used. The value must be non−negative.Valuesbetween 0 and 999 are typically reserved for system accounts.The user´s mailbox, and anyfiles which the user owns and which are located in the user´s homedirectory will have the file user ID changed automatically.The ownership of files outside of the user´s home directory must be fixed manually.−U,−−unlockUnlock a user´s password. This removes the ´!´ in front of the encrypted password. You can´t use thisoption with−p or−L.Note: if you wish to unlock the account (not only access with a password), you should also set theEXPIRE_DATE(for example to99999,or to the EXPIRE value from /etc/default/useradd).−Z,−−selinux−user SEUSERThe SELinux user for the user´s login. The default is to leave this field the blank, which causes thesystem to select the default SELinux user.CA VEATSYou must make certain that the named user is not executing any processes when this command is beingexecuted if the user´s numerical user ID, the user´s name, or the user´s home directory is being changed.usermod checks this on Linux, but only check if the user is logged in according to utmp on otherarchitectures.You must change the owner of any crontabfiles or at jobs manually.You must make any changes involving NIS on the NIS server.CONFIGURATIONThe following configuration variables in /etc/login.defs change the behavior of this tool:MAIL_DIR(string)The mail spool directory. This is needed to manipulate the mailbox when its corresponding useraccount is modified or deleted. If not specified, a compile−time default is used.MAIL_FILE(string)Defines the location of the users mail spool files relatively to their home directory.The MAIL_DIR and MAIL_FILE variables are used by useradd,usermod,and userdel to create, move, or delete the user´s mail spool.If MAIL_CHECK_ENAB is set to yes,they are also used to define the MAIL environment variable.MAX_MEMBERS_PER_GROUP(number)Maximum members per group entry. When the maximum is reached, a new group entry (line) isstarted in /etc/group (with the same name, same password, and same GID).The default value is 0, meaning that there are no limits in the number of members in a group.This feature (split group) permits to limit the length of lines in the group file. This is useful to makesure that lines for NIS groups are not larger than 1024 characters.If you need to enforce such limit, you can use 25.Note: split groups may not be supported by all tools (even in the Shadow toolsuite). You should notuse this variable unless you really need it.FILES/etc/groupGroup account information./etc/gshadowSecure group account information./etc/passwdUser account information./etc/shadowSecure user account information.SEE ALSOchfn(1),chsh(1),passwd(1),crypt(3),gpasswd(8),groupadd(8),groupdel(8),groupmod(8),login.defs(5),useradd(8),userdel(8).。
虚拟机常用命令
编辑本段Linux基本操作命令首先介绍一个名词“控制台(console)”,它就是我们通常见到的使用字符操作界面的人机接口,例如dos。
我们说控制台命令,就是指通过字符界面输入的可以操作系统的命令,例如dos命令就是控制台命令。
我们现在要了解的是基于Linux操作系统的基本控制台命令。
有一点一定要注意,和dos命令不同的是,Linux的命令(也包括文件名等等)对大小写是敏感的,也就是说,如果你输入的命令大小写不对的话,系统是不会做出你期望的响应的。
编辑本段模式切换1、由字符到图型#startx或#init 52、由图形到字符#logout或init 33、注销#logout或exit或ctrl+d4、关机#poweroff或init 0或shutdown now或 halt -p5、重启#reboot或init 6或shutdown -r now编辑本段获得帮助#help提供内部命令的帮助#man或info提供外部命令的帮助。
如果你的英文足够好,那完全可以不靠任何人就精通linux,只要你会用man。
Man实际上就是察看指令用法的help,学习任何一种UNIX类的操作系统最重要的就是学会使用man这个辅助命令。
man是manual(手册)的缩写字,它的说明非常的详细,但是因为它都是英文,看起来非常的头痛。
建议大家需要的时候再去看man,平常吗,记得一些基本用法就可以了。
编辑本段lsls [list]这个命令就相当于dos下的dir命令一样,这也是Linux控制台命令中最为重要几个命令之一。
ls最常用的参数有三个: -a -l -F。
ls -aLinux上的文件以“.”开头的文件被系统视为隐藏文件,仅用ls命令是看不到他们的,而用ls -a除了显示一般文件名外,连隐藏文件也会显示出来。
ls -l(这个参数是字母L的小写,不是数字1)这个命令可以使用长格式显示文件内容,如果需要察看更详细的文件资料,就要用到ls -l这个指令。
