June 2020
M T W T F S S
« Mar    
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

WordPress Quotes

Be Content with what you have; rejoice in the way things are. When you realize there is nothing lacking, the whole world belongs to you.
Lao Tzu
June 2020
M T W T F S S
« Mar    
1234567
891011121314
15161718192021
22232425262728
2930  

Short Cuts

2012 SERVER (64)
2016 windows (9)
AIX (13)
Amazon (40)
Ansibile (19)
Apache (135)
Asterisk (2)
cassandra (2)
Centos (211)
Centos RHEL 7 (270)
centos8 (3)
chef (3)
cloud (2)
cluster (3)
Coherence (1)
DB2 (5)
DISK (25)
DNS (9)
Docker (30)
Eassy (11)
ELKS (1)
EXCHANGE (3)
Fedora (6)
ftp (5)
GIT (3)
GOD (2)
Grub (1)
Hacking (10)
Hadoop (6)
health (2)
horoscope (23)
Hyper-V (10)
IIS (15)
IPTABLES (15)
JAVA (7)
JBOSS (32)
jenkins (1)
Kubernetes (7)
Ldap (5)
Linux (188)
Linux Commands (166)
Load balancer (5)
mariadb (14)
Mongodb (4)
MQ Server (24)
MYSQL (84)
Nagios (5)
NaturalOil (13)
Nginx (35)
Ngix (1)
openldap (1)
Openstack (6)
Oracle (35)
Perl (3)
Postfix (19)
Postgresql (1)
PowerShell (2)
Python (3)
qmail (36)
Redis (12)
RHCE (28)
SCALEIO (1)
Security on Centos (29)
SFTP (1)
Shell (64)
Solaris (58)
Sql Server 2012 (4)
squid (3)
SSH (10)
SSL (14)
Storage (1)
swap (3)
TIPS on Linux (28)
tomcat (62)
Ubuntu (1)
Uncategorized (30)
Veritas (2)
vfabric (1)
VMware (28)
Weblogic (38)
Websphere (71)
Windows (19)
Windows Software (2)
wordpress (1)
ZIMBRA (17)

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Who's Online

0 visitors online now
0 guests, 0 bots, 0 members

Hit Counter provided by dental implants orange county

RHCE7 certification study notes

RHCE7 certification study notes

— system file directory structure

, RHEL7 system file directory

Basically RHEL7 directory structure remains the same as the original directory structure RHEL6,
the difference is, RHEL7 increasing the Run directory, the default file is used to automatically mount CD-ROM, and CD-ROM in RHEL6 default mount directory is the Media.

choose manual zoning, you must divide the partition: /, boot, swap.

2, reinstall the system, you only need to format the “/” directory to other directories on their own partitions without formatting, keeping the original user files are not deleted

 

[root@RHEL7HARDEN /]# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@RHEL7HARDEN /]#

 
study notes 2

— command line file

1, create and delete files

Create a file touch xxxx

touch -t 20151225 create a file and specify time properties

rm xxx  delete the file

rm -rf forced to delete files

2. Create a directory and delete the directory

mkdir -p xxx/yyy recursively create directories;

rmdir xxx delete empty directories;

rm -rf XXX  forcibly remove non-empty directories;

3, copy files and directories

cp /path1/xxx /path2/xxx/

cp -p /path1/xxx /path2/yyy copy files to retain the original file attributes;

cp -Rf (or -rf)/path1/ /path2/ copy files to a directory directory path1 path2

cp -a   cp -dR –preserve=all

4 Cut files

mv /path1/xx /path2/yy

5 View Files

cat xx less
more
less

3– redirection and piping

Redirect correct content:

cat xx.file> yy.file equivalent

cat xx.file 1> yy.file redirected to the file contents yy.file, will overwrite the original file contents;

cat /etc/passwd & >> /tmp/xx

cat /etc/passwd > /tmp/xx 2>&1

tail -f /var/log/messages >/tmp/xx 2>/tmp/yy

ps  aux | grep tail | grep -v ‘grep’

ls -al /dev/

to redirect the file contents input to a command

tr

cat > /tmp/xxx <<EOF
>test1
>test2
>test3
>EOF

cat <<EOF> /tmp/xxx
>test2
>test3
>test4
>EOF

number of rows grep -n before looking for the number of rows plus -i ignore case, -A 3 looking for then displayed, B 3 show the number of rows -v looking for negative keywords before after content, -q Do not display output;

grep -n1 B1 -A root /etc/passwd

ifconfig | grep ‘inet’|grep -v ‘inet6’| awk ‘BEGIN{print “IP\t\tnetmask”}{print $2,”\t”,$4}END{}’

ifconfig | grep ‘inet’|grep -v ‘inet6’| tee -a /tmp/yy|awk ‘BEGIN{print “IP\t\tnetmask”}{print $2,”\t”,$4}END{}’

4 – Vim editor use

1, gedit graphical editing files

2, Vim operating a file, if the file exists is opened, if the file does not exist, it is created:

When using Vim to edit the file to open, the default is the command-line mode:

4. When you edit the file, enter the command line insert mode, press the following keys to enter:

i, from the current cursor enters;

a, from the current cursor one character to enter;

o, in the current row into the next row;

I, from the current cursor jump to the beginning of the line and into the Bank;

A, skip to the end and enter the Bank;

O, in the Bank of the line to insert a row;

r, to replace the current character;

R, to replace the current character and move to the next character;

number + G: jump to a specific row, such as 10G jumps to line 10, GG jump to the last line, gg jump to the first line;

number + yy: copy current number of rows down, in any line can be pasted by p;

number + dd: Cut down the number of rows currently in any line adhesive according to p;

u: undo the last step of the operation;

ctrl + r: to restore the previous step;

ctrl + v: to enter visual block mode, the cursor moves up and down, select the content, press y copy selected content, at any position by pasting;

Fast beginning of the line to add a comment #, move the cursor to select the line, then press I to the start position,

press #, press ESC to exit

#abrt:x:173:173::/etc/abrt:/sbin/nologin
#pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
#gdm:x:42:42::/var/lib/gdm:/sbin/nologin
#gnome-initial-setup:x:993:991::/run/gnome-initial-setup/:/sbin/nologin
:split?ctrl+w

To view detailed help Vim, you can enter Vimtutor.

5, line mode to save the file, find, property settings, replacement and other operations

Enter the last line mode, ESC from insert into command mode, enter 🙁 / or generally used to find, n from the look down, N from the look-up)

Save: wq to save and exit, or x;

Force Quit: q without saving the file content;!

Display line numbers: set nu, if the default display line numbers, you will need to modify the home directory vimrc file or / etc / vimrc, no file is created, insert a row set nu;

Switching specified line: direct input line number;

Replace: 1,$s /old /new /g Replace globally all

m, ns /old /new /g replace m row to match the contents of all n rows, on behalf of the current line, $representatives last line,
$ -. 1 represents the penultimate line, (1, $) can also be used to replace%,
They are expressed full text. If you want to match the contents of which have special characters such as /, *, etc., to be added in front of the escape character \

You can use the s # old # new #, using the # separator, the special characters do not need to escape;

Find backslash below, if you want to ignore the case, look at the back of the content plus \ c, for example: / servername \ c

study notes 5– manage users and user groups

[root@RHEL7HARDEN /]# passwd –help
Usage: passwd [OPTION…] <accountName>
-k, –keep-tokens       keep non-expired authentication tokens
-d, –delete            delete the password for the named account (root only)
-l, –lock              lock the password for the named account (root only)
-u, –unlock            unlock the password for the named account (root only)
-e, –expire            expire the password for the named account (root only)
-f, –force             force operation
-x, –maximum=DAYS      maximum password lifetime (root only)
-n, –minimum=DAYS      minimum password lifetime (root only)
-w, –warning=DAYS      number of days warning users receives before password expiration (root only)
-i, –inactive=DAYS     number of days after password expiration when an account becomes disabled (root only)
-S, –status            report password status on the named account (root only)
–stdin                 read new tokens from stdin (root only)

Help options:
-?, –help              Show this help message
–usage                 Display brief usage message
[root@RHEL7HARDEN /]#

[root@RHEL7HARDEN /]# chage –help
Usage: chage [options] LOGIN

Options:
-d, –lastday LAST_DAY        set date of last password change to LAST_DAY
-E, –expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
-h, –help                    display this help message and exit
-I, –inactive INACTIVE       set password inactive after expiration
to INACTIVE
-l, –list                    show account aging information
-m, –mindays MIN_DAYS        set minimum number of days before password
change to MIN_DAYS
-M, –maxdays MAX_DAYS        set maximim number of days before password
change to MAX_DAYS
-R, –root CHROOT_DIR         directory to chroot into
-W, –warndays WARN_DAYS      set expiration warning days to WARN_DAYS

root@RHEL7HARDEN /]# useradd –help
Usage: useradd [options] LOGIN
useradd -D
useradd -D [options]

Options:
-b, –base-dir BASE_DIR       base directory for the home directory of the
new account
-c, –comment COMMENT         GECOS field of the new account
-d, –home-dir HOME_DIR       home directory of the new account
-D, –defaults                print or change default useradd configuration
-e, –expiredate EXPIRE_DATE  expiration date of the new account
-f, –inactive INACTIVE       password inactivity period of the new account
-g, –gid GROUP               name or ID of the primary group of the new
account
-G, –groups GROUPS           list of supplementary groups of the new
account
-h, –help                    display this help message and exit
-k, –skel SKEL_DIR           use this alternative skeleton directory
-K, –key KEY=VALUE           override /etc/login.defs defaults
-l, –no-log-init             do not add the user to the lastlog and
faillog databases
-m, –create-home             create the user’s home directory
-M, –no-create-home          do not create the user’s home directory
-N, –no-user-group           do not create a group with the same name as
the user
-o, –non-unique              allow to create users with duplicate
(non-unique) UID
-p, –password PASSWORD       encrypted password of the new account
-r, –system                  create a system account
-R, –root CHROOT_DIR         directory to chroot into
-s, –shell SHELL             login shell of the new account
-u, –uid UID                 user ID of the new account
-U, –user-group              create a group with the same name as the user
-Z, –selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping

[root@RHEL7HARDEN /]# usermod –help
Usage: usermod [options] LOGIN

Options:
-c, –comment COMMENT         new value of the GECOS field
-d, –home HOME_DIR           new home directory for the user account
-e, –expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
-f, –inactive INACTIVE       set password inactive after expiration
to INACTIVE
-g, –gid GROUP               force use GROUP as new primary group
-G, –groups GROUPS           new list of supplementary GROUPS
-a, –append                  append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, –help                    display this help message and exit
-l, –login NEW_LOGIN         new value of the login name
-L, –lock                    lock the user account
-m, –move-home               move contents of the home directory to the
new location (use only with -d)
-o, –non-unique              allow using duplicate (non-unique) UID
-p, –password PASSWORD       use encrypted password for the new password
-R, –root CHROOT_DIR         directory to chroot into
-s, –shell SHELL             new login shell for the user account
-u, –uid UID                 new UID for the user account
-U, –unlock                  unlock the user account
-Z, –selinux-user SEUSER     new SELinux user mapping for the user account

[root@RHEL7HARDEN /]# useradd test1
[root@RHEL7HARDEN /]#  mkdir /home/test
root@RHEL7HARDEN /]# usermod -d /home/test1 test
usermod: user ‘test’ does not exist
[root@RHEL7HARDEN /]# cp -a /etc/skel/.[^.]* /home/test/
[root@RHEL7HARDEN /]# groups test1
test1 : test1
usermod -a -G mohan test1

usermod -g

[root@RHEL7HARDEN /]# gpasswd –help
Usage: gpasswd [option] GROUP

Options:
-a, –add USER                add USER to GROUP
-d, –delete USER             remove USER from GROUP
-h, –help                    display this help message and exit
-Q, –root CHROOT_DIR         directory to chroot into
-r, –delete-password         remove the GROUP’s password
-R, –restrict                restrict access to GROUP to its members
-M, –members USER,…        set the list of members of GROUP
-A, –administrators ADMIN,…
set the list of administrators for GROUP
Except for the -A and -M options, the options cannot be combined.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

Blue Captcha Image
Refresh

*

Protected by WP Anti Spam