Mostrando entradas con la etiqueta env. Mostrar todas las entradas
Mostrando entradas con la etiqueta env. Mostrar todas las entradas

viernes, 3 de febrero de 2023

linux user and group command and files

List of Linux Commands related to groups:


- useradd 

- userdel 

- groupadd 

- groupdel 

- groupmod 

- gpasswd 

- chgrp 

- newgrp 

- groups 

- id 


List of Files associated with groups:


- /etc/group 

- /etc/gshadow 

- /etc/gshadow- 

- /etc/group- 

- /etc/passwd 

- /etc/shadow 

- /etc/security/group.conf 

- /etc/security/group.d/

-------------------------------------

Linux commands associated with users:  


-adduser: Add a new user  

-useradd: Create a new user or update default new user information  

-usermod: Modify a user account  

-userdel: Delete a user account  

-userdefaults: Set user defaults  

-passwd: Change user password

-chage: Change user password aging and expiry  

-chfn: Change user information for finger  

-chsh: Change user login shell  



Linux files associated with users:  


-/etc/passwd: User account information  

-/etc/shadow: Encrypted user password  

-/etc/group: Group information  

-/etc/gshadow: Group password information  

-/etc/login.defs: User and group defaults  

-/etc/default/useradd: Useradd defaults  

-/etc/skel: Default user setup files for new user accounts  

-/home/: Home directory for users  

-/etc/security/: User and group security informationr

martes, 3 de enero de 2023

adding customization for new and existing user and displaying a welcome message


1) edit the skeleton file

nano /etc/skel/.bashrc


2) Add customizations  (We will apply default editor and a message it times user logged in)

add these content to   /etc/skel/.bashrc

export EDITOR=/usr/bin/nano

echo   "welecome $(whoami),  all your activity on this system is monitored"


3) Apply changes

 source  /etc/skel/.bashrc


4) Test creating a new user

useradd  kathy -m -c "guest account"


5) verify   reading the content user's .bashrc file

cat  /home/kathy/.bashrc


--------------------------------------------------------------


 

If you want customization for an existing user, edit the user  .bashrc file, in this example we will do it with the user kathy

1) nano  /home/kathy/.bashrc

2) add changes

export EDITOR=/usr/bin/vi

echo   "Hello dear  $(whoami)"



3) save it

source /home/kathy/.bashrc











jueves, 29 de diciembre de 2022

Linux creating enviroment variables

 echo  "export pass=19933"  >./env

 source ./env

 echo $pass

https://phoenixnap.com/kb/linux-source-command#:~:text=In%20Linux%20systems%2C%20source%20is,to%20be%20read%20and%20run.

sábado, 17 de diciembre de 2022

creating a Linux user and adding ssh root public key

 

useradd -m ambiorixg12


cp -R /root/.ssh /home/ambiorixg12  


cd  /home/ambiorixg12/.ssh


chmod -R 755 .ssh







ssh ambiorixg12@101.10.32.13.1



method 2 just  replace the username variable

username=linux_admin;useradd -m $username && cp -R /root/.ssh /home/$username && chmod -R 755 /home/$username/.ssh



adding to the sudo group

usermod -aG sudo linux_admin

Review

id linux_adin

lunes, 5 de diciembre de 2022

Linux change default editor and show user group

 


1 nano $HOME/.bashrc


2 export EDITOR=/usr/bin/nano


3 source .bashrc




useradd  ambiorix

  passwd ambiorix


usermod -aG sudo ambiorix