Linux commands (user management, group and time management)

  • User Management   

  • Linux system is a multi-user system
  • Users are divided into three categories: superuser (root) user id is 0 pseudo user id of the user 1 ---- 499 while there, but not by ordinary users login user id pseudo 500 --- 60000.
  • Location of the user information stored in: / ect / passwd file to view the information cat / etc / passwd
  • The syntax for creating a user: useradd -u user id -g hostname -c -G users of other user group name description (alias) User Name
  •  useradd -u 666 -g root -G sys,users,admin -c 'newUser' uqy97a
  • View user belongs syntax group uq97a
  • View user syntax cat / etc / passwd
  • Simple way to create user syntax useradd username
  • User password passwd user name syntax
  • Change the name before the name to modify the user login name syntax usermod -l modification
  • Delete users (already logged in user can not be deleted)
  • userdel -r username name
  • Switch user su username name (root user switching without a password)
  • User group management

  • Linux there is more than one group
  • Group information stored in the location / etc / group
  • View the document cat etc / goup
  • Add a group
  • group username name
  • Delete Group
  • groupdel username name
  • time

  • View the current time date
  • Modified date MMDDHHMMYYYY (month, day, hour, minute, year)
  •                              date -s 'yyy-mm-dd HH: MI: SS' (year, month, day, hour, minute, second)
  • Change the time zone
  • cp /etc/share/zoninfo/Asia/Shanghai  /etc/localtime
  • Use network synchronization current time
  • ntpdate pool.ntp.org
  • View the current system ntpd service is turned on
  • service      ntpd   status
  • Set boot time                   chkconfig ntpd on    
  • sudo usage

  • sudo command to elevate certain non-root user privileges:
  • With root inputs vim / etc / sudoers file commands the root ALL = (ALL) ALL line copy user root to the regular user to save
  • Switch to the ordinary user input back sudo sudo poweroff shutdown operation command you want to operate

Guess you like

Origin www.cnblogs.com/hph1728390/p/11084986.html