Posts

Showing posts from May, 2018

User Management in Linux[How to create User,group]

User Management: What is a shell? A shell is a user interface where we execute commands/scripts There are diifferent Shells available: 1. ksh (K Shell) 2. sh (Born Shell) 3. bash Born Again Shell 4. csh 5. tcsh etc., /etc/shells: contains list of shells installed in our machine /etc/passwd: contains information about all user accounts fields Description 1 username 2 password(Encrypted) 3 User ID 4 Group ID 5 GCOS (fullname, phoneno. etc., information about user) 6 home dir 7 shell useradd: used to add a user account syn: useradd <-options> username -g: to set primary group to a user -G: to set secondary group(s) for a user -s: to specify shell -d: to set home directory * what are options used to set UID,GCOS ex: #groupadd dba #useradd -g dba -G users -s /bin/sh -d /home/dba1 king #id King [display information about user King] #useradd -g dba -G users,uclid01 -d /home/dba2 -s /bin/sh Raju user ID for root -- 0 user Id's: 1 to 499 -- system accou...

Compression Tools in Linux[TAR,gzip]

Compression Tools: tar: to compress files compress files: ``````````````` syn: tar -cvf <tarfilename> <file(s)> ex: tar -cvf files.tar hello.txt hi.txt raj.txt -c: create -v: verbose -f: tar file name Uncompress files: ````````````````` syn: tar -xvf files.tar tar with GZIP feature: `````````````````````` compress: tar -czvf files.tar.gz file1 file2 file3 file4 uncompress: tar -xzvf files.tar.gz -------------------------------------------------------------------------- gzip & gunzip: gzip: to compress file(s) ex: gzip hello.txt gunzip: to uncompress the file(s) ex: gunzip hello.txt.gz ----------------------------------------------------------------------- Storing and Analysing Logs: What is a log file: A log file is that which have information about all activities done on a linux serer. By default log files will be available under /var/log/ folder. Files: messages: Contains most of the information about different activites secure : contains securi...

How to create Linux Partition using Fdisk Command .

fdisk: Used to create/manage/delete partitions on linux operating system # fdisk -cul /dev/sda Shows information about partitions Creating and using a partition: 1. Use fdisk to create a partition' fdisk -cu /dev/sda 2. reboot the server 3. format the partition mkfs -t ext4 /dev/sda4 4. Mount the partition # mkdir /king # mount /dev/sda4 /king 5. verify the mount # df -h Mounting FS permanenlty: 1. add the follwoing entry in /etc/fstab file /dev/sda4 /king ext4 defaults 0 0 2. use the command 'mount -a' How to unmount a partition: umount /dev/sda4 (or) umount /king -------------------------------------------------------------------- How to mount a partition with UUID 1. generate UUID # blkid /dev/sda5 2. Copy the UUID generated and add it in fstab file ex: UUID=980d09ds8f08sd0fsd0f8sd08 /king ext4 defautls 0 0 --------------------------------------------------------------------- managing swap partitions ```````````````````````` 1. use 'fdisk' to...

How to configure IP Address.

command: system-config-network Once if ip address is set, restart the network service service network restart How to verify IP Address of our machine # ifconfig # ip addr show eth0 How to activate ethernet device: ifup eth0 How to deactivate ethernet device: ifdown eth0 Configuration file for 'eth0' device: /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static HWADDR=00:0c:29:66:73:a8 ONBOOT=yes IPADDR=192.168.42.100 NETMASK=255.255.255.0 ping: To check wether the machine is accessable or not ping 192.168.42.100 hostname: shows the hostname of ur server # hostname To change hostname temporarily # hostname server.example.com /etc/hosts: Location in our machine where hostnames are resolved. We can add all hostnames in this file as follows: 192.168.42.100 server.example.com server 192.168.42.200 client.example.com client /etc/resolv.conf: this is the file where DNS server IP is set search example.com nameserver 192.168.42.127 hostname...

Special Permissions in Linux . {setUID,setGID,Sticky Bit]

Special Permissions: ```````````````````` setUID setGID Sticky Bit setUID: Is allocated for files, so that who ever may run this file, process owner will be the owner of file(script). chmod u+s hello.sh hello.sh--> rw-r--r-- ==> rwSr--r-- setGID: file: how ever my run the script, process group will be the scripts actul group. dir: Who ever may create a file in this directory, the file group will be same as of the directory group. ex: # mkdir /king (owner:root, group: root) # chmod g+s /king [rwxrwsr-x] User kumar creates a file in this directory hello.txt --> owner: kumar, group: root sticky bit: Is set only on directory so that any user can create files in this directory, but only the owner of file can remove such file, but not others # chmod o+t /stage [rwxrwxrwt] user: kumar $cat > /stage/madhu.txt ds;lfjl;sjdgl; ctrl+z user: madhu $rm /stage/madhu.txt --> error --------------------------------------------------------------------------- ACL:...

ACL: Access Control List

ACL: Access Control List Using ACL we can give permissions to specific users/groups on a file/dir setfacl -m : to add ACL permissions syn: setfacl -m <whome>:<name>:<permissions> filename ex: setfacl -m u:user1:rw hello.txt setfacl -m u:user2:r hello.txt setfacl -m g:dba:rwx hello.txt setfacl -x: to remove permissions syn: setfacl -x <whome>:<name> filename ex: setfacl -x u:user1 hello.txt setfacl -x u:user2 hello.txt setfacl -x g:dba hello.txt getfacl: to view permissions on a file syn: getfacl filename ex: getfack hello.txt note: for a newly created partition we have set acl,user_xattr mount options so that files in this partition can be set with ACL permissions tune2fs -o acl,user_xattr /dev/sda7

What is LVM ? How to create LVM Partition ?

Image
LOGICAL VOLUME MANAGEMENT:         LVM(Logical Volume Management) MBR Partition P Sda1 P Sda2 P Sda3 P Sda4 M B R P1 Sda1 P2 Sda2 P3 Sda3 Extended Partition   (sda4) Logical Partitions are sub partition of Extended Partition. L1 Sda5 L2 Sda6 L3 Sda7 L4 Sda8 L5 Sda9 L6 Sda10 L7 Sda11 L8 12 L9 (13) L10 (14) L11 Sda (15) Primary Physical Partition = 4 Physical Partition : (3P+1E) =    4 Physical + Logical Partition =      (3P+1E)   +   (11L) =   15 Partition .   How to use LVM: P P P LVM   (50G)             PV   ...