My file bash, and configurate for linux

http://ariaf.my.id/linux_aria/linux_dasar/4.html


4

user info

command

whoami
groups
id

users # active sessions
who # active sesions
w # active sesions

su <user> # switch user / subsitute user
sudo su # super user do

user information

/etc/passwd

  • UID = user identified
    • 0 = root
    • 1…499 = daemons (only runs service)
    • 1000… = users

/etc/group

  • GID = group identified

/etc/shadow

create user

useradd (manual add user)

useradd <nameuser>
useradd <nameuser> -m # m => with home dir, M => without home dir

useradd <nameuser> -m -d /home/nama # with dir
useradd <nameuser> -m -d /home/nama -s /bin/sh # with shell
useradd d -m -d /home/d -s /bin/bash
  • default user add
    useradd -D
      GROUP=100
      HOME=/home
      INACTIVE=-1
      EXPIRE=
      SHELL=/bin/sh
      SKEL=/etc/skel
      CREATE_MAIL_SPOOL=no
    

adduser (with setup user)

sudo adduser e
Adding user `e' ...
Adding new group `e' (1009) ...
Adding new user `e' (1008) with group `e' ...
Creating home directory `/home/e' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for e
Enter the new value, or press ENTER for the default
        Full Name []: e
        Room Number []: e
        Work Phone []: e
        Home Phone []: e
        Other []: e
Is the information correct? [Y/n] y

passwd

passwd <nameuser> # change password for user

more

  • cat /etc/passwd
    user:x:id:gid:fullname:
    # x => real pass in /etc/shadow
    
  • cat /etc/group
    group:x:gid:[members]
    
  • bin
    • bin/sh
    • bin/bash
    • bin/false

modification user

usermod

## blocking user
usermod -L name # lock
usermod -U name # unlock
    ### if u make lock user in /etc/shadow ur hash into !$hash from $hash

usermod -d /home/user99 user99
usermod -s /bin/bash user99