GNU/Linux >> Linux Esercitazione >  >> Cent OS

RHEL 7 – RHCSA Note:creare, eliminare e modificare gli account utente locali

RHEL 7 – Note RHCSA (cheat sheet)

Aggiunta di un account utente

Usa useradd comando per aggiungere un nuovo utente :

# useradd [options] [username]

Le impostazioni predefinite per il nuovo utente possono essere visualizzate e modificate utilizzando l'opzione -D :

# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

Ad esempio, per modificare la shell utente predefinita per il nuovo utente in /bin/ksh :

# useradd -D -s /bin/ksh

Esempi

Per aggiungere semplicemente un utente con tutte le opzioni predefinite:

# useradd user01

Per aggiungere un utente con uid 1099, commenta "nuovo utente" e la shell predefinita come /bin/ksh :

# useradd -u 1099 -c "new user" -s /bin/ksh user01

Controlla la voce del nuovo utente in /etc/passwd file :

grep user01 /etc/passwd
user01:x:1099:1099:new user:/home/user01:/bin/ksh

Per modificare l'utente esistente (ad es. cambiando il commento):

# usermod -c "modified user" user01

Per assegnare la password a un nuovo utente:

# passwd user01
Changing password for user user01.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Visualizza /etc/shadow file :

# grep user01 /etc/shadow
user01:$6$dox84xyJ$89DdMcxSlI9OHxUCyY1ryaFsmG6MSEwbmSbZXJoFY.tHgdEEeQQgQjDV0dD8jEiHusrUjj3p8gtMTKR4sXXN5.:17058:0:45:7:::

Per eliminare l'utente :

# userdel user01

shell di accesso

È possibile creare un utente con shell nologin per l'esecuzione di servizi come SMTP, FTP ecc. Un utente senza una shell di accesso non può accedere a un sistema e quindi non può eseguire alcun comando sul sistema in modo interattivo sul sistema. Tuttavia, i processi possono essere eseguiti come tali utenti.

Per aggiungere un nuovo utente "test" con shell nologin :

# useradd -s /sbin/nologin test

Assicurati che la shell nologin sia presente in /etc/shells file :

# cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin


Cent OS
  1. Crea ed elimina utenti in Ubuntu 20.04

  2. Come creare ed eliminare un gruppo di utenti in Linux

  3. Crea/elimina account secondari in cPanel

  4. Crea ed elimina utenti locali su Windows Server

  5. Crea, gestisci ed elimina utenti e gruppi in Active Directory

Come creare un utente MariaDB e concedere privilegi

Come eliminare un utente su RHEL 8 / CentOS 8 Linux

Come creare ed eliminare account di posta elettronica gratuiti in cPanel?

RHEL 7 – RHCSA Notes – Imposta modalità di applicazione e permissive per SELinux

RHEL 7 – RHCSA Notes – Creare e gestire Access Control List (ACL)

RHEL 7 – RHCSA Note:pianifica le attività utilizzando at e cron