Posts

Showing posts from March, 2021

Linux - Upgrading Firmware on HP server.

Pre-checks: 1. Ensure OS backup and system configuration backup. 2. Ensure the availability of Hands and eyes support in the data center. Download patches to /var/tmp sut -status   ( system update manager - from HP  ? ) sut - set mode=Autodepoly #rpm -Uvh <fimrware.rpm> #rpm -qlp <firmware.rpm> ./hpsetup ( may need to execute a script like this ) Reboot the server and ensure the firmware is update.

ACL - access control list

 Access control list (ACL):- ************************** -> the main purpose of using the acl perm is to provide perticular user or group permissions on perticcular file or dir. -> we have 2 types of identification 1) trival entry:- ***************** if the perm of file/dir contains "+"  symbol after permissions thenn that file /dir is having ACL permissions ex: #ls -l -rw-r--r-- + root  root ---- ----  f1 2) non-trival entry:- ******************** if the perm of file/dir contains "." symbol after permissions then the file/dir is not having ACL permissions ex: #ls -l  -rw-r--r-- . root  root  ----- ------ f1 to get acl perm of file/dir:- **************************** #getfacl  <file/dir name>  ex: #getfacl f1 file: f1 owner: root group: root user: rw- group: r-- others: r-- setting  acl perm for file/dir:- ****************************** #setfacl -m   u:<username>:<permission>,g:<groupname>:<permis...

Special permissions - sgid

 SGID(set group ID):- ******************* -> it is applied  for dir to change the ownerships of  a dir recursively for upcoming files & dir in that perticular dir -> it is represented by "s"  and in terms of numbers we have "2". to apply SGID:- *************** #chmod g+s  <directory path> ex: #chmod g+s  /root/d1 #ls -ld  /root/d1 drwxr-sr-x   --  ---- ---- /root/d1 remove the SGID permission:- *************************** #chmod g-s   /root/d1 stick bit:- ********** -> it is used to enforce other users from deleting  files & dir created by root user or normal user. -> it is applied for others -> it is represented by "t"  it terms of numbers "1" -> it can only be applied for dir but not files to apply sticky bit:- ******************** #chmod o+t <file/dir name>   

sudo user and special permission

 deleting of user:- ***************** #userdel <username>   --> to delete a user without deleting his home dir ex: #userdel maa #userdel -r <username>  --> to delete a user with its home dir ex: #userdel -r tokyo creating  a sudo user:- ********************** -> the main purpose of creating a sudo user is to give a restricted permissions of root user to normal user -> all the details of sudo user are stored in /etc/sudoers file #vim /etc/sudoers locate the line number 100 and add the entry in next line <username> ALL=(ALL) <binary path of command> ex: zafar ALL=(ALL) NOPASSWD:/usr/sbin/useradd     suhaib ALL=(ALL) ALL -> for groups if u want to give a sudo permission then go to 107 line and add the entry in next line %<group name> ALL=(ALL) <binary path of  command> %kxip ALL=(ALL) NOPASSWD:/usr/sbin/useradd :wq! --> to know the binary file path of a command is  #...

User Management - useradd, usermod & gpasswd commands

 user management:- *************** creating a user with variants: ****************************** #useradd -u <custom UID>  <username>   --> to create a user with different UID ex: #usseradd -u 14000  half  #useradd -c <description> <username>  --> to create a user with description ex: #useradd -c mommy maa  #useradd -g <primary group>  <username>   --> to create  a user with existing primary group ex: #useradd -g kxip pbj #useradd -G <seconadry group> <username>   --> to create a user and add the user to some secondary group ex: #useradd -G tokyo red #useradd -d <home dir>  <username>   -->> to create a user with different home dir ex: #useradd -d /d1   public #cd /d1  #cp /etc/skel/.* /d1/ #useradd -s <shell path>  <username>   --> to create a user with diffferent shell path ex: ...

User Management

 user management:- *************** creating a user with variants: ****************************** #useradd -u <custom UID>  <username>   --> to create a user with different UID ex: #usseradd -u 14000  half  #useradd -c <description> <username>  --> to create a user with description ex: #useradd -c mommy maa  #useradd -g <primary group>  <username>   --> to create  a user with existing primary group ex: #useradd -g kxip pbj #useradd -G <seconadry group> <username>   --> to create a user and add the user to some secondary group ex: #useradd -G tokyo red #useradd -d <home dir>  <username>   -->> to create a user with different home dir ex: #useradd -d /d1   public #cd /d1  #cp /etc/skel/.* /d1/ #useradd -s <shell path>  <username>   --> to create a user with diffferent shell path ex: ...

Linux:- House Keeping on /var filesystem.

/var reached threshold. #cd /var  #du -sh * | sort -hr | head - lists files using most space. - You can look for log files that root is owing. - You can compress log files.

User and group management

user and group managment:- ************************* user --> the pernson who is using the perticular machine group: -> the collection of users  is calles as group user management: **************** -> users have there own UID for the kernel and username is for our referance -> UID from 1 to 999 is applied  for default users. -> the users we create are started with UID 1000 +  -> the complete user details are stored in /etc/passwd  file -> the password related details are stored under /etc/shadow file #vim /etc/passwd <username>:<pointer to password>:<UID>:<primary group ID>:<description>:<home directory>:<shell path> ex: root:x:0:0:root:/root:/bin/bash #vim /etc/shadow <username>: <encrypted password>: <password aging> root: bcslsdbbvjksd  c dbdjkvjwdnvv d cm: 99999: 7: creating  a user: ***************** #useradd <username> --> to create default user ex: #useradd fed ...

Linux listing commands, inode number and links

 listing command =================== #ls -------------it will list out all the files and directories under ur pwd #ls -F--------it will show u which and all are files and which and all are directories ls -l---------to list all the files and directories along with their permission under the pwd -rw-r--r--.   1 root root    0 Mar 11 06:04 f2 -  -------it indicates normal file d  --------it indicates a directory l  ----------it is a linked file rw- -------------this permission is for the owner of the file r-- ----------------this permission is for the group owner of this file r-- -------------------this permission is for the others . --------no acl permission + --------acl permission has been applied 1 --------------no of links root ------------owner of that file root -------------group owner of that file 0 ---------------size of the file #ls -l <fn>-----------------it will list out the permission for a particular file #ls -ld <dn> ------...

Vi or Vim Editor

 vi/vim  editor:- ************** #vi <filename>  --> to create or edit a file using vi editor ex: #vi f1 #vim <filname>   command not found #yum install vim -y  #vim <filename> ex: #vim f2 -> we have 3 modes in vi/vim editor 1) insert mode 2) command mode 3) colon mode   insert mode shortcuts:- *********************** esc + i  ---> to enter into insert mode esc+shift+i  --> moves the cursor position to present line first character. esc+shift+a  ---> moves the cursor position to present line last position. esc+o  --> moves to cursor to below line and creates a new line esc+shift+o  --> moves the cursor to above line and creates a new line esc --> to exit from insert mode command mode shortcuts:- *********************** esc+shift+h  --> to move the cursor to first line first position  esc+shift+g  --> to move the cursor to last line first position esc+ j   -...

df and find command

 disk free commands:- ******************** #df  ---> display all filesystem info in blocks #df -a  --> display all mounted filesystem info along with dummy filesystem #df -h  --> display all filesystem info in human readable language #df -k  --> display all FS info in KB's #df -m    --> display all fs info in MB's #df -T  --> display all FS info with its Filesystem type #df -Th  ---> display FS info with its type in human readable language find commands:- ************** #find   .     -name   <filename>    --> to search for  a file in my PWD                   #find   /     -name   <filename>    --> to search for a file in / dir. #find  /   -iname <filename>   --> to search for a file with ignoring cases ex: #find / -iname  Zafar ...

File Permissions and Umask

 permissions:- ************ -> the set of rules set according to users & groups & others are called as permissions -> we 3 basic permissions -> in the permission "." after the permissions is represents that mo ACL permission is applied. 1) read --> r --> 4 2) write -> w --> 2 3) execute -> x -> 1 #ls -l  --> to list the perm of all normal files & dir user owner group owner others - rw- r-- r-- <user owner> <group owner> ----- ---- <filename> d rwx r-x r-x <user owner> <group owner> ----- ----- <dir name> - rw-rw-rw- d rwxrwxrwx  umask [user mask] ***************** -> umask value determines default permissions on file & dir -> max perm for file is 666 -> max perm for dir is 777 -> by default umask vaule of root user  "022" -> by default umask vaule of normal user "002" -> umask is nothing but changing the perm of fi...
Image
 Architecture of UNIX / Linux Operating System: Kernel is the heart of an Operating System. It can be analogous to an engine of a car. Kernel is "the operating system". History of Linux In short, Linux was born when UNIX was made as closed source by its founding company, AT&T. For a short of time UNIX was a open source operating system.