Chinaunix首页 | 论坛 | 博客
  • 博客访问: 955409
  • 博文数量: 116
  • 博客积分: 3923
  • 博客等级: 中校
  • 技术积分: 1337
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-23 01:22
文章分类

全部博文(116)

文章存档

2013年(1)

2012年(17)

2011年(69)

2009年(29)

分类: 系统运维

2011-09-06 15:33:07

today, i found it's a great many problems with non-root group when using the ubuntu, so i decide to change my user into root group, because my input without Chinese, so i marked it here with english.

1. ok, let us begin from the /etc/group file, it marks the GID of all user, include root user. so you first "sudo chmod 777 group", and then edit it with emacs(maybe you using VI or GEdit), see follwing:

section of your user item in file "group", change the third field from 1000 to 0(root)

  1. chenws:x:0:



2. so you also need to modify the /etc/passwd, as above describe, you must modify the file owner first, then edit it as below part:

section of your user item in file "passwd", change the third and the fourth fields from 1000 to 0(root)

  1. chenws:x:0:0:chenws,,,:/home/chenws:/bin/bash


3. you need NOT to twist the /etc/shadow file, because there is NOT any GID or UID infomation in it, so you just restart your machine.

you can get more detailed from following web:



  1. User Account and Group Management

  2. User and Group system files
  3. User Account Management
  4. Group Management

  5. User and Group system files

  6. All Linux distributions keep their user and group dates in the same place. Below are the common locations of system account files:
  7. /etc/passwd - User account information
  8. /etc/shadow - Secure user account information
  9. /etc/group - Group information
  10. Format of /etc/passwd

  11. The /etc/passwd files are generally configured with the same general format across Linux platforms. This file gives a listing of the users that have accounts on the system. Users can be directly added to the file when edited by root, but users are typically added using the adduser(Debian) or useradd commands.

  12. username:password:uid:gid:user_info:home_directory:shell_type
  13. username - The name the person logs in with
  14. password - Typically x to indicate a password is set
  15. uid - The system number assigned to a user to indicate which files they own or have access to.
  16. gid - The group id number which is the principle group they belong to.
  17. user_info - Information about user separated by a comma. Possible information includes: Full name, Room number, Work number, Home phone, and Other
  18. home_directory - The directory that the user owns. Typically /home/username
  19. shell_type - The default shell setting is /bin/bash.
  20. Format of /etc/shadow

  21. The /etc/shadow file is the encrypted password file. This file is not typically directly edited.

  22. username:encrypted password:11843:0:99999:7:::
  23. username - The name the person logs in with
  24. encrypted password - Typically x to indicate a password is set
  25. #:#:#:#::: - Contains information about the number of days since the password was changed, when it expires or is disabled.
  26. Format of /etc/group

  27. The /etc/group files are configured with the same general format across platforms. It lists the groups that have been created on the system and who is in each group. Groups can be managed by creating new lines in the file following the convention, users can be added to an already existing group by adding the new username to the end of the other usernames or after the semicolon of the gid if there are no other members.

  28. username:password:gid:username1,username2,username3
  29. username - The name the person logs in with
  30. password - An x indicates a password is set and if left blank no password has been set.
  31. gid - The group id number which is the principle group they belong to.
  32. usernames - Members of the group separated by a comma
  33. Format of /etc/shadow - encrypted Samba password file

  34. login name:encrypted password:information about days since password changed and when expired or disabled

  35. User Account Management

  36. Adding users to a system
  37. useradd

  38. The universal command to add users to a Linux system is useradd login and is commonly used with the option as explained below. An explanation of the other options can be found at man useradd

  39. useradd -D login - It will add the user with any specified command line options in addition to the default settings on the system.
  40. adduser - Debian specific

  41. An option on Debian is to use the command adduser. It has a more user friendly interface than useradd. The program prompts for the username, user ID, Group ID, Home directory, and shell.

  42. Removing users from a system Some times it is necessary to delete users from a computer. There is a similar command to useradd that will delete the user. Below is a short explanation of userdel.
  43. userdel

  44. The common command to delete users from a system is userdel. When used with the option it will remove the login's home directory and all files in it along with the user's mail spool.

  45. userdel -r login

  46. Deletes entries in the system account files that refer to the login
  47. deluser - Debian specific

  48. A different front end to the userdel. It can remove the home directory, or all files on the system owned by the user based on the options specified.
  49. Command Action
  50. deluser Does not remove the home directory, mail spool, or any files owned by the user
  51. deluser --remove-home user Removes the home directory and mail spool
  52. deluser --remove-all-files user Removes all files on the system owned by the user

  53. Group Management
  54. groupadd - Adding Groups

  55. groupadd - using default values from the system and command line specified values groupadd creates groups on the system.

  56. groupadd group

  57. the specified gid should be unique.
  58. addgroup - Debian specific Adding Groups

  59. addgroup - friendlier front ends - the group is created with no users, two non-option arguments will add an existing user addgroup --system group common options
  60. delgroup - Debian specific

  61. This command will delete a system group that is not the primary group of a user. A system group would be one created with the addgroup command.
  62. groupmod - Tool to modify groups

  63. Once groups are created on the computer they will need to be modified and edited at some point. The groupmod command will change the group id associated with a group or the name of the group.

  64. groupmod [-g gid ] group

  65. -g gid group's numerical identification number. [any files which the old group ID is the file group ID must have the file group ID changed manually.

  66. -n groupname - this option changes the name of the group from the initial group name to the groupname specified in the command

  67. Example command Resulting action
  68. groupmod -g 120 example Changes the group id number to 120 for group "example"
  69. groupmod -n group2 group Changes the group name of group to group2

  70. Groups can be added and modified by directly access in the /etc/groups folder and modifying it. If a group is modified in this manner, chmod should be run to change the group attributes of files that were associated with the group ID.
  71. smbpasswd - Samba account mangagement

  72. When run as an ordinary user smbpasswd will prompt for old samba password and then twice for the new password. In order for the command to work the smbd daemon must be running. The password of the user logged in will change

  73. When smbpasswd is run as root it allows new users to be added or deleted to smbpasswd file. The command accesses the local smbpasswd file directly. The commands used as roots are:

  74. smbpasswd username

  75. Options:

  76. -a following username should be added to the local smbpasswd file
  77. -x following username should be deleted from local smbpasswd file

good luck!
阅读(2931) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~