Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

3.3 bash details 2

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Cls (clear screen inside windows)

Command alias

Aliases defined in shell are valid only for the current shell lifecycle, valid scope of aliases

For the current shell process

Alias CMDALIAS='COMMAND [option] [arguments]'

Alias cls = clear

Unalias CMDALIAS undo alias

The command is made up of the original command plus options, using the original command:

\ CMD

Command replacement: $(COMMAND) backquotes (quotes under wavy lines) `COMMAND`

The process of replacing a subcommand in a command with the result of its execution

Echo "The current directory is $(pwd)."

Touch. / file-$ (date +% F-%H-%M-%S) .txt

Quotation marks supported by bash:

``: command replacement

"": weak reference, you can implement variable substitution

'': strong reference, do not complete variable replacement

File name wildcard globbing

* any character of any length

Ls a *

Ls axi3

Ls

? Match any single character

[] matches any single character within the specified range

[abc] [0-9] [amurz] [a-zA-Z]

[^] matches any single character outside the specified range

[: space:] White space character

[: punct:] punctuation mark

[: lower:] lowercase letters

[: alpha:]

[: digit:] number

[: alnum:]

Man 7 glob help

[[: alpha:]] * [[: space:]] * [^ [: alpha:]]

Touch'a b'

Exercise: display all files that end in numbers and do not contain white space in the file name

Ls * [^ [: space:]] * [0-9]

3.4 linux users and permissions

Users: identifiers

User groups, easily assign permissions, associate permissions, user containers, identifiers

The process is used by the agent user to access the computer

There are owners and groups in the process.

Security context (secure context)

File:

R: readable, you can use commands such as cat to view the contents of the file

W: writable, you can edit or delete this file

X: executable, eXacutable, which can be submitted to the kernel to run as a command at the command prompt

Catalogue

R: you can ls this directory to list all internal files

W: files can be created in this directory

X: you can use cd to change to this directory, or you can use ls-l to view the details of internal files

(the directory has execute permission by default, and the file does not have execute permission by default)

000-0

111 rwx 7

User: UID / etc/passwd

Group: GID / etc/group

Shadow password:

User: / etc/shadow (password)

Group: / etc/gshadow

Resolution: name resolution

User category:

Administrator: 0

Ordinary user: 1mm 65535

System user 1-499

General users 500-60000

User groups:

Administrators Group:

General group:

System group

General group

User group category:

Private groups: when you create a user, if you do not specify the group to which you belong

The system automatically creates a group with the same name as the user name

Basic group (user's default group)

Additional group, extra group, group other than default group

Cat / etc/passwd

Whatis passwd view section (view configuration file contents in detail)

/ etc/passwd is as follows

Account: login name

Password: encrypted format (X placeholder)

UID:

GID: basic group ID

GECOS (comment): optional, possibly empty, user's comment

HOME DIR: home directory

SHELL: the user's default shell

Cat / etc/shells view all legitimate shell

The cat etc/shadow content is as follows

Account: login name

Encrypted password: encrypted password (previous paragraph of impurity)

Add a user:

Useradd command useradd username useradd tom

Adduser is the soft connection of useradd

Ls-l $(which useradd)

Root users can add a password to the user: passwd tom

Cd / etc/default/

Cat useradd

Encryption method:

Symmetric encryption: encrypt and decrypt using the same password

Public key encryption: each password appears in pairs, one is the public key (public key)

One is private key (secret key)

Single encryption, hash encryption, extraction of data signature, non-reversible, often used for data integrity

Sex check

1) Avalanche effect, a little change in initial conditions, a great change in the result

Md5sum / etc/initable

2) fixed length output

MD5:Message Digest information summary 128bit fixed length output

SHA1:Secure Hash Algorithm 160bit fixed length output

Cat / etc/group

Groupadd DRPNAME

User Management:

Useradd userdel usermod passwd chsh chfn finger id chage

Group Management:

Groupadd groupdel groupmod groupwd

Rights Management:

Chown chgrp chmod

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report