Learning Red Hat Linux


1. Installation partition scheme:
    (1) Swap partition, twice the memory
    (2) /boot partition
    (3) / all the remaining space
Language selection English (English)

2. Configure IP
IP address and subnet mask:
  edit /etc/sysconfig/network-script/ifcfg-eth0
    DEVICE=eth0
    BOOTPROTO=static - static or dynamic
    BROADCAST=192.168.1.255
    IPADDR=192.168.1.35 - IP address
    NETMASK= 255.255.255.0 --subnet mask
    NETWORK=192.168.1.0 --network ID
    ONBOOT=yes
gateway:
  edit /etc/sysconfig/network
    NETWORKING=yes
    HOSTNAME=vmlinux --hostname
    GATEWAY=192.168.1.2 --gateway
DNS:
  Edit /etc/resolv.conf
    nameserver 61.147.37.1
    nameserver 61.177.7.1
Note: The above IP addresses must be changed to the IP addresses corresponding to your network configuration. " "Before you, pay attention to capitalization.
MAC address change under RedHat Linux
  1. The network card device must be closed first, otherwise it will report that the system is busy and cannot be changed.
       /sbin/ifconfig eth0 down
  2. Modify the MAC address.
       /sbin/ifconfig eth0 hw ether 00AABBCCDDEE
  3. Re-enable the network card
       /sbin/ifconfig eth0 up
  The MAC address change of the network card is completed.  
Another method is to modify the configuration file ifcfg-ethx of the network card and add the MAC address in a similar format: HWADDR=00:AA:BB:CC:DD:EE.

Three, server configuration vsftpd configuration 

Installation and startup
1. Use the following command to check whether it has been installed:
    #rpm -qa|grep vsftpd
    vsftpd-2.0.5-10.e15
If the above result appears, it means that it has been installed. If it is not installed, you can find the installation package on the Red Hat Enterprise Linux5 installation CD, use the command:
vsftp-2.0.5-10.e15.i386.rpm is located in the second iso file
    #mount /dev/cdrom /mnt/cdrom
    #rpm -ivh vsftp-2.0.5-10.e15.i386.rpm
2. The startup and shutdown
    commands are: #service vsftpd start The
    stop command is: #service vsftpd stop The
    restart command is: #service vsftpd restart
    Query the running status: #service vsftpd status
    vsftpd (pid 3571) in progress... 3.     There are three main configuration files for
Vsftpd server configuration Vsftpd:         /etc/vsftpd/vsftpd.conf            /etc/vsftpd.ftpusers           /etc/vsftpd.user_list It is recommended to use before modification The cp command backs up these three files. After the modification is completed, the vsftpd service needs to be restarted for the settings to take effect.





(1) Anonymous user access configuration
1. After the FTP server is started, the
  anonymous user can log in. In the text mode, the user name is ftp, and the password is also ftp to log in; if the FTP tool is used to log in anonymously, the user name and The passwords are: anonymous. By default, anonymous users can access and download, but cannot upload, delete, create new directories, execute files, etc.
  Local users can log in, and can leave their own directory to other directories that they have access to, and perform operations with permission. For uploads and downloads, local users written in the file /etc/vsftpd.ftpusers are prohibited from logging in.
2. To allow anonymous users to upload files
    , you need to modify the /etc/vsftpd/vsftpd.conf file and remove the # before the following two items.
    anon_upload_enable=YES
    anon_mkdir_write_enable=YES to
    restart the vsftpd service.
3. Only allow anonymous users to access
    means that local account access needs to be restricted. Modify the /etc/vsftpd/vsftpd.conf file and remove the # before the following two items.
    local_enable=YES
    write_enable=YES to
    restart the vsftpd service.
4. Set the welcome message
    Modify the
    /etc/vsftpd/vsftpd.conf file ftpd_banner=*****
    ***** is the set welcome message.
    Restart the vsftpd service.
5. Set the maximum transfer rate
    Modify the /etc/vsftpd/vsftpd.conf file
    to set the maximum transfer rate of anonymous users to 20Kbps, and add the following statement:
    anon_max_rate=20000
    To set the maximum transfer rate of local accounts to 1Mbps, add the following statement:
    local_max_rate=1000000
6. Set the server The maximum number of concurrent users and the maximum number of threads for users
    Modify the /etc/vsftpd/vsftpd.conf file
    to set the maximum number of concurrent servers to 99, and the following statement should be added:
    max_clients=99 To
    set the maximum number of user connections in the same period, the following statement should be added:
    max_per_ip= 5
7. Prohibit anonymous access to the server by hosts in some IP segments.
    Modify the vsftpd.conf file and confirm that there are the following statements:
    tcp_wrappers=YES
    Modify the /etc/hosts.allow file and add one line of command:
    vsftpd:192.168.1.1:DENY
    means restriction The host whose IP is 192.168.1.1 accesses the FTP server.
    Restart the vsftpd service.
8. Use ASCII method to transfer data
    and modify /etc/vsftpd/vsftpd.conf file,
    ascii_upload_enable=YES
    ascii_download_enable=YES to
    restart the vsftpd service.
9. Set the data transmission interruption interval.
    Modify the /etc/vsftpd/vsftpd.conf file,
    idle_session_timeout=600
    indicates that the idle session time is 600 seconds.
    data_connection_timeout=120
    indicates that the data connection timeout is 120 seconds.
    Restart the vsftpd service.

(2) Local user access configuration
1. Use the user list for access control
    Modify the /etc/vsftpd/vsftpd.conf file and set it according to the following statement:
    userlist_enable=NO
    indicates that the users in the vsftpd.ftpuser file will be prohibited from accessing the FTP server.
    userlist_enable=YES
    userlist_deny=NO
    indicates that only users in the vsftpd.user_list file are allowed to access the FTP server.
    userlist_enable=YES
    userlist_deny=YES
    indicates that neither the users in the vsftpd.ftpuser nor the vsftpd.user_list files can access the FTP server.
2. Restrict access to user directories
    Modify the /etc/vsftpd/vsftpd.conf file
    chroot_local_user=YES
    to indicate that users cannot access other directories or files other than their own directory after logging in.
3. Modify the default port
    The default port of the FTP server is 21. If you need to modify the port, please modify the /etc/vsftpd/vsftpd.conf file. The following statement:
    listen_port=4444
    indicates that the port number of the FTP server is 4444, which should be larger than 4000 as much as possible. 
    vsftpd login with root user 530 login incorrect error
    There is a directory in etc/pam.d/vsftpd that points to etc/vsftpd/fptusers
    , delete root in it, and you can
    open the root user upload permission and turn off the system firewall, but the ftp connection will still appear " 500 OOPS: cannot change directory:/root" error, how to solve it?
Solution:
1. Check the status of SELinux:  
    sestatus -b | grep ftp Exactly, just check the status of ftp.
2. You can see  
        ftp_home_dir off 
        tftpd_disable_trans off
    and the like in the results that appear. We just need to set one of them to on for now.
3. setsebool -P ftpd_disable_trans on or setsebool -P ftp_home_dir on 
4. Restart vsftpd: service vsftpd restart
5. Enjoy the fun of ftp slowly.

vsftpd login error problem: 500 OOPS: cannot change directory:/root
You can use an ftp client on windows to try to log in. At this time, an error is usually reported.
Invalid user permission error
Delete root in ftpuser and root in user_list It is
best to turn off the Linux firewall: chkconfig iptables off
and then log in again
500 OOPS: cannot change directory:/root
Solutions:
1. Check the status of SELinux:  
    sestatus - b | grep ftp    

2. In the results that appear, you can see  
    ftp_home_dir off  
    tftpd_disable_trans off
and the like. We just need to set one of them to on for now.
3. setsebool -P ftpd_disable_trans on or setsebool -P ftp_home_dir on  
4. Restart vsftpd: service vsftpd restart

The default VSFTP service starts automatically at boot:
permanently open or close the firewall
chkconfig iptables on
chkconfig iptables off
Method 1: (common and convenient)
    [root @localhost etc]# chkconfig --list|grep vsftpd (check the situation)
    vsftpd 0:off 1 :off 2:off 3:off 4:off 5:off 6:off
    [root @localhost etc]# chkconfig vsftpd on (execute ON setting)
or: Method 2:
Modify the file /etc/rc.local, put the line /usr /local/sbin/vsftpd & into the file to automatically start at boot.

530 Permission denied. I
 re-installed linux under the virtual machine today. Now I want to start the ftp server that comes with linux: #service vsftpd start. If you want linux to start the ftp server automatically: #chkconfig vsftpd on 
 run putty, enter as root, and an error 530 Permission denied appears, which is very strange, because ordinary users can enter.
 The reason is that our /etc/vsftpd.ftpusers and /etc/vsftpd.user_list disable the root user. At this point we need to modify these two files.
  (1) The default file of /etc/vsftpd.user_list (representing specific users)
        # vsftpd userlist
        # If userlist_deny=NO, only allow users in this file
        # If userlist_deny=YES (default), never allow users in this file, and
        # do not even prompt for a password.
        # Note that the default vsftpd pam config also checks /etc/vsftpd.ftpusers
        # for users that are denied.
        root
        bin
        daemon
        adm
        lp
        sync
        shutdown
        halt
        mail
        news
        uucp
        operator
        games
        nobody
        At this point we need to add # before root.
    (2) The default file of /etc/vsftpd.ftpusers (all user attributes that can log in to the FTP)
        # Users that are not allowed to login via ftp
        root
        bin
        daemon
        adm
        lp
        sync
        shutdown
        halt
        mail
        news
        uucp
        operator
        games
        nobody
        At this time, we need to add # before root.
The following error occurs:
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
This error is caused by the opening of the firewall of the window, and closing the firewall can solve it.

4. Uninstall and install MySQL under Linux
1. Find out if MySQL was installed before
Command: rpm -qa|grep -i MySQL
You can see two MySQL packages:
MySQL-4.1.12-3.RHEL4.1
MySQLclient10-3.23. 58-4.RHEL4.1
2. Delete MySQL
delete command: rpm -e --nodeps package name 
( rpm -ev MySQL-4.1.12-3.RHEL4.1 )
3. Delete the development header files and libraries of the old version of MySQL

Command: rm -fr /usr/lib/MySQL 
rm -fr /usr/include/MySQL 
Note: After uninstalling, the data in /var/lib/MySQL and /etc/my.cnf will not be deleted. Manually delete
rm -f /etc/my.cnf
rm -fr /var/lib/MySQL
Install MySQL
Preparation before installation: two rpm packages
MySQL-client-5.1.20-0.glibc23.i386.rpm
MySQL-server-5.1 .20-0.glibc23.i386.rpm
1. Install the server:
command: rpm -ivh MySQL-server-5.1.20-0.glibc23.i386.rpm
2. Install the client
command: rpm -ivh MySQL-client- 5.1.20-0.glibc23.i386.rpm 
3. Log
in to MySQL The command to log in to MySQL is MySQL. The syntax of MySQL is as follows:
MySQL [-u username] [-h host] [-p[password]] [dbname]
username and password are the username and password of MySQL respectively. The initial management account of MySQL is root without a password. Note: this root user is not a Linux system user. The default user of MySQL is root. Since there is no password initially, you only need to type MySQL when you first log in
[root @localhost ]~]# MySQL
    1. Command
   usr/bin/mysqladmin -u root password ''new-password''
   Format: mysqladmin -u username -p old password password new password
   2. Example
   Example 1: Add a password of 123456 to root.
   Type the following command:
   [root @test1 local]# /usr/bin/mysqladmin -u root password 123456
   Note: Because root has no password at the beginning, the -p old password can be omitted.
The "MySQL>" prompt appears, congratulations, the installation is successful! 
   The login format after adding the password is as follows: 

   MySQL -u root -p 
   Enter password: (enter password) 

Follow the official account to get a variety of videos

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325240740&siteId=291194637