2019-9-12: penetration testing, based learning, notes

linus User Management
/ etc / passwd store user information
/ etc / shadow save your password information, the second part! Meaning that the password is not set

cat / etc / passwd | grep xxx: View account-specific information

useradd Options Username: Adding a user
passwd Username: Password add
userdel username: Deleting a user
su: switch user

View the currently logged on user: whoami, id

View the current user belongs: Groups
groupadd group name: Add Group
groupdel group name: delete group
/ etc / group, group directory
/ etc / gshadow, group password directory
group every part of the explanation, xxx (group name):! (Password): (GID) :( current user group)
gpasswd -a group name username: Add the user to the desired group in
gpasswd -d group name username: the user to remove the group wants

grep Content Path: Find what

Usage: useradd [option] Log
useradd -D
useradd -D [options]
Options:
-b, based home directory --base-dir BASE_DIR new account
-c, GECOS field --comment COMMENT new account
-d, home directory --home-dir HOME_DIR new account (home directory, home directory, the default directory)
-D, --defaults display or change the default configuration useradd
-e, expiration date --expiredate EXPIRE_DATE new account
-f, password inactivity --inactive iNACTIVE new account
-g, the name of a new account or ID --gid gROUP primary group
-G, additional lists --groups gROUPS new account
-h, --help display this help and launched
-k, --skel SKEL_DIR use this directory as a skeleton directory
-K, --key KEY = vALUE /etc/login.defs not use the default value of
-l, --no-log-init Do not add this user to the nearest login and the login fails database
-m, --create-home create the user's home directory
-M, --no-create-home does not create the user's home directory
-N, --no-user-group is not created with the same name group
-o, --non-unique UID allows repeated to create a user
-p, new account password after --password PASSWORD encryption
-r, --system create a system account
-R, --root CHROOT_DIR chroot to the directory
-s, login shell --shell SHELL new account (parser)
-u, --uid UID new user account ID, and is generally used with -o, like other users to create user ID
-U, --user-group group creates user of the same
-Z, --selinux- SELinux user mapping for the user SEUSER specified SEUSER
--extrausers the use The Extra users Database

usermod options user name, modify the user
options:
-c, --comment comment for the new value GECOS field
-d, --home HOME_DIR user's new home directory, usermod -d / home / xxx sym , sym home directory will be changed to xxx
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, expire after a few --inactive INACTIVE INACTIVE days, set a password for invalid state
-g, --gid gROUP gROUP is forced to use the new primary group, usermod - g root stm, user groups into the root sym group
-G, --groups gROUPS new additional list the gROUPS
-a, --append the gROUP user to append additional groups mentioned in the upper -G,
not from other remove this user group
-h, --help display this help and launched
-l, --login LOGIN new login name, modify the user name, usermod -lx x1, x name changed to x1
-L, - lock lock the user account, usermod -L, disabled users
-m, --move-home directory contents will be home to a new location (only to be used with -d)
-o, --non-uNIQUE allow duplicate (non-unique a) UID
-p, --password pASSWORD the encrypted password (pASSWORD) set a new password
-R, --root CHROOT_DIR chroot to directory
-s, --shell SHELL the new user account login shell, usermod -s / bin / zsh sym, the shell into the sym zsh
-u, the UID user --uid the new UID account
-U, --unlock unlock user accounts, usermod -U, lift disabled
-v, --add-subuids FIRST-LAST of the subordinate, the Add the Range UIDs
-V, --del-subuids FIRST-LAST of the Remove the Range UIDs the subordinate,
-w, --add-LAST-FIRST subgids the subordinate, the Add Range of GIDs
-W, --del-LAST-FIRST subgids Remove Range GIDs of the subordinate,
the -Z, --selinux-user SEUSER new user account user mapping SELinux

Linux file types
- binary file
d directory
l link file
to view file details directory: ls -l
file type and number of files in subdirectories rights group belongs to the owner of the file size of the file was last modified time of the file name
drwxr-xr-x 14 root root 40968 Yue 03:11 Ar 6
drwxr-XR-the X- , the first one is the file type, the second to the fourth, the file owner permissions, the fifth to the seventh, the file permissions of the group owning the 8th to 10th, other user rights, first for - to represent a binary file, back to - to indicate a lack of permission
r read permission, privilege value 4
w write permission, permission value 2
the X-execute permissions, permission value 1

Meaning permissions for files and directories in
          the file directory
r can view the contents of the directory can be listed LS
w can modify the file in the directory can create and delete files RM Touch
the X-files can be performed cd into the directory

Modify the permissions command
chome who + / - / = filename certain rights
who u g belongs to the owner of a group o others have everyone
+ Add permission - permission = Cancel give permission, you can also write numbers directly, it is recommended to use a digital method

Change an owner or owning group
chown root file, the owner of the file is modified to root
chgrp group file name, belongs to the group will modify the file name for the group
chown user: group file name, the file owner and group of modified
chown - R uppercase users: group name directory, all files in the directory modification

Common command
netstat: View network information
nslookup: View DNS information
ps: View running processes
top: real-time view running processes
service: open service control off
curl URL: Get page
wget: Download file

View source
  1, View-Source: HTTPS: // url
  2, F12
  3, right-click the page

Memory management
ps -u or L
  the -l list form, showing the process currently being used
  -aux | grep xx show processes from all users in the system information, display the specified process
  -ls | grep ssh process information

end process

kill -9 pid: Forced shutdown process

kill -l: restart the process

killall process name: Close all of the same name process

top dynamic display of process information, q to quit
-c display the full command
-d top update time
-p pid, view a specific information Pid
pid (Process ID) USER (user-owned) PR (process priority) NI (nice value indicates the priority level) VIRT (virtual memory) the RES (physical memory) the SHR (shared memory) (state)% CPU (cpu utilization)% MEM (memory footprint) tIME + (cpu time using the sum of) the cOMMAND (command)

free, memory usage, display free memory, the physical memory, swap memory, buffer

linux Network Management
netstat -ano: windows to view the network port information system
netstat -ntulp: See under linux network port information
traceroute: View from data information in the network
ss: display communication information socket
  -t -a display tcp connection
  -l display open network ports
  -pl process uses socket

ssh configuration file path, / etc / ssh / sshd_config

Download and install software

First, change the update source directory location: vim /etc/apt/sources.list

apt-get update & apt-get upgrade & apt-get autoclean:更新源

apt-get autoclean: If your hard disk space is not the case, you can run the program on a regular basis, I would have removed the packages to install .deb files deleted from your hard drive. If you still need hard disk space, you can try apt-get clean, it will take you installed package installation package also removed, of course, in most cases these packages useless, so this is a place of hard disk Teng good idea.
apt-get clean: similar to the above command, but it removes all the packages in the package cache. This is a good practice, because in most cases these packages useless. But if you are dial-up, then you have to reconsider.
apt-get autoremove: Delete order to meet the other dependent packages installed, but package is no longer needed.
Other:
APT-GET the Remove Package name: Remove a package (save the configuration file) installed.
apt-get --purge remove the package name: delete the installation package (does not retain the configuration file).

vm-tools-desktop installation method

apt-get install open-vm-tools-desktop, installation vntools, reboot after installation

Finish

Guess you like

Origin www.cnblogs.com/sym945/p/11514677.html