Experiments Notes - September 12

morning:
 
User management under Linux
User information is stored / etc / passwd, the average user has read access
Real users: change the password, you can log
Pseudo-users: the application will run at runtime some privileges, and use the program name to represent the program, and the presence of / etc / passwd file, the user can not log in directly pseudo
pentest (user name): x (password): 1000 (UID): 1000 (GID): pentest ,,, (description): / home / pentest (home directory): / bin / bash (default parser)
The last change to / sbin / nologin, the user can not log
User passwords are stored in / etc / shadow, under normal circumstances, ordinary users do not have permission to read
pentest (username): $ 6 $ Fq0je7pf $ kDasczSHFj9k1XO2xArIymt8IzDK97jbXjD8XvFvVMohp2RBHMKBuUbHSlR6NBlhh1tFrxe0tujp.fmgW9kKB (password) /: 18150 (last modified time password): 0 (effectively modify the minimum time password): 99999 (maximum time): 7 :::
After three is password policy
Add user:
useradd [option] username
useradd –u 5000 –g demogroup –G root –d /home/demo –s /bin/bash demo
-u UID specify
-g specified group
-G specified user also belong to other groups
-d specifies the home directory (home directory, home directory, the default directory)
-s specifies the parser
-o -u and general use, create, and other users of the same user ID
Plus password:
Passwd username
delete users:
Userdel Username
            Modify a user:
                Usermod -l / -d / -g / -s username
                    -l modify the user name: usermod -l test number
                    -d modify the home directory: usermod -d / home / ko test
-g modify the owning group: usermod -g root test
-s modify the parser: usermod -s / bin / zsh test
            Disable User: usermod -L username
            Restore user: usermod -U username
Users are automatically added by default user name and join the same group
Icq   icq
Root  root
Pentest pentest
Su switch user
View the current logged-on user: whoami id
View the current user belongs to which group: groups
There are currently viewing Linux which groups:
groupadd group name
groupdel group name
PVM pentest @: ~ $ grep test / etc / group
adm: x: 4: syslog, pentest
cdrom: x: 24: pentest
sudo: x: 27: PenTest
DIP: x: 30: pentest
plugdev: x: 46: pentest
lpadmin: x: 121: Pentest
pentest: x: 1000:
sambashare: x: 132: PenTest
test (group name): x (Group Password): 1001 (GID) :( what the user's current group)
Adding users to the test group pentest:
gpasswd -a test pentest
The pentest user is removed from the test group:
gpasswd -d pentest test
 
Meaning folder permissions for files and folders:
        File Folder
R can view the file contents can List Folder Contents
w can modify the file can create and delete the folder
x can execute the file can access the folder
Change Permissions command
Chmod [who] [+ | - | =] filename
    Who: u-> owner g-> belongs to the group o-> others a-> everyone
    + Add permission - permission to cancel the assignment of certain rights =
r--r--r--  test.php
Chmod +320 test.php
Rwxrwxrwx evil.php
Chmod -333 evil.php
Chmod 644 evil.php
Note: The recommended way to change the permissions of digital
Change an owner or owning group
Chown root / test root test will change the owner of the folder
Chgrp admin / test will change the admin test ask price belongs to group folders
Chown root: root / tmp will be the owner of the / tmp folder belongs to root group to root
Chown -R root: root / tmp the owner of all files in / tmp to root to root belonging group
 
in the afternoon:
 
Tar compress and decompress files
netstat - View network status
nslookup - View dns
ps - Check program run
top - real-time view of the running program
service - service controller enables close control services
curl - page redirects
wget - download file
 
Memory Management
ps - View system processes
ps -u / -l - are affiliated with the current user process information
ps -aux - Check the system for all users process information
ps -ls | grep ssh - Process Information
ps -aux | grep apache - Apache view of process information
 
Killl close a process
kill pid - close the program corresponding to the pid
-9-- forced to close
-l - restart the process
kill al - shut down all processes
 
View Port Information
top display process information
top -c Show full command
top -d 5 - Updated
top -p pid - view a specific information pid
 
free linux idle display memory, the physical memory, swap memory, buffer
 
linux network management
ping
ifconfig
route
netstat
arp
traceroute - view packet path in the network
 
ss - shows that the socket communication information
ss -t -a --tcp connection
ss -l - Show all network ports open
 
 
Xshell connected Kail system ssh
xshell-- help us to connect various service platform to facilitate the management server
 
step1: open ssh service kail in, service ssh start, detection is turned on success, / etc / init.d / ssh status or netstat -ntulp | grep 22
step2: turn off the firewall /etc/init.d/iptable stop, and then open the ssh configuration file, the location vim / etc / ssh // sshd_config file, line 27 before and after the "#PermitRootLogin prohibit-password" changed to "PermitRootLogin yes" , save and exit!
Step 3: service ssh restart, use xshell connection using the root account or accounts common
Step 4: xshell:? File New protocol selection ssh, enter kali host of IP, port 22 is the default, click "Connect", then enter the root account, and finally enter a password to connect?.
Note: ssh service can change the port, edit the configuration file, port 22 - port 2222?
 
Kali replacement update source
Vim /etc/apt/sources.list
Leafpad   /etc/apt/sources.list
# Ali cloud Kali source
deb http://mirrors.aliyun.com/Kali time playing non-free contrib
deb-src http://mirrors.aliyun.com/Kali Kali main non-free contrib
deb http://mirrors.aliyun.com/Kali-security Kali/updates main contrib non-free
 
apt-get update&&apt-get upgrade&&apt-get autoclean
 
Kali install software
Apt search open-vm-tools-desktop
Apt-get install open-vm-tools-desktop
reboot
 

Guess you like

Origin www.cnblogs.com/yyhfirstblog/p/11521047.html