Linux FTP and Samba configuration notes

Source: Internet
Author: User

Environment: Windows XP SP2 + vmware workstation 6.1 + Red Hat Enterprise 5.1

 

The content of this article is based on your own practices and online search materials.

 

(1) FTP configuration steps in Linux:
(1) Check whether vsftpd is installed:
Rpm-Qa | grep-I vsftpd

(2) enable the system service as the system starts:
Chkconfig vsftpd on

(3) Start the vsftpd Server:
/Etc/init. d/vsftpd start

(4) test:
FTP localhost
If it is normal, the logon information will appear.

(5) Configure vsftpd as follows:
1) Change "anonymous_enable = yes" to "anonymous_enable = No", indicating that anonymous users are not allowed to log on.
2) Remove # Before # chroot_list_enable = yes and change it to chroot_list_enable = No, which indicates that the user is allowed to leave the directory.
Alternatively, remove the # Before # chroot_list_enable = Yes, remove the # Before chroot_list_file =/etc/vsftpd/chroot_list, and create the file chroot_list in the/etc/vsftpd/directory, add a user. This indicates that users in the chroot_list file list cannot leave the home directory, and other local users can leave this directory.
Alternatively, add the row chroot_local_user = No before # chroot_list_enable = yes to allow the user to leave the directory. If chroot_local_user = yes is added, the local user is locked in the local directory.
3) Change userlist_enable = yes to userlist_enable = No. The user restriction function is disabled.
4) Remove the user root in the/etc/vsftpd/ftpuser file to allow the root user to log on. Users in the ftpusers file list cannot log on to the FTP server.

(6) Disable seliunx, VI/etc/SELinux/config, and set SELinux = disabled.

(7) restart the machine.

Then you can use root to log on.

If the following error is displayed when you log on to vsftpd: cannot change Directory:/root is caused by the failure of FTP in SE configuration.
Run the getsebool ftpd_disable_trans command.
Can view the current status if it is not on
Enter the command: setsebool ftpd_disable_trans 1
Of course, you can also add the-p Parameter so that you do not need to enter this command every time you start the system.
Setsebool-P ftpd_disable_trans 1
Similarly, we can do this if the smb service encounters the same problem.
Setsebool-P samba_enable_home_dirs = 1
SELinux Management in management tools can also be used to adjust relevant configurations.

Basic FTP Server Configuration:
Directory:/etc/vsftpd, which contains five files:
Chroot_list: it does not exist by default. After adding users to it, these users are locked in the local directory when chroot_list_enable = yes.
Ftpusers: users not allowed to log on to the FTP server
User_list: In vsftpd. conf, userlist_deny = yes. users in the file list are not allowed to log on to the FTP server. This is the default value. Userlist_deny = No, only users in the file list are allowed to log on.
Vsftpd. conf: Main configuration file
Vsftpd_conf_migrate.sh

 

(2) Steps for configuring Samba in Linux:

(1) Check whether Samba is installed
Rpm-Qa | grep-I samba

[Root @ localhost Samba] # rpm-Qa | grep-I samba <br/> samba-common-3.0.33-3.28.el5 <br/> samba-client-3.0.33-3.28.el5 <br/>

Rhel5 only installs the client by default.

(2) If the server is not installed, download the Server Source Code and go to the soure3 directory (the source4 directory is a test version, and the former is a stable version). perform the following installation steps:
./Autogen. Sh
./Configure
Make
Make install
(3) In examples in the source code directory, copy smb. conf. default to the/usr/local/samba/lib directory and change it to smb. conf.
/Usr/local/samba/bin/testparm
Check whether the smb. conf configuration syntax is incorrect and whether the configuration is successful.
(4) Configure smb. conf
# Vi smb. conf
There are two places that cannot be changed
Workgroup = Workgroup (name of the working group on my windows machine)
Added: Unix charset = cp936
DOS charset = cp936
Display charset = cp936
These three settings aim to display Chinese characters when "Network Neighbor" is used on Windows to share folders and files on Linux.
(5) add SMB users

1. set/etc/lD. so. add a new line in conf:/usr/local/samba/lib. This step is to solve an error (use the following command to add an error to the SMB User): Error while loading shared libraries: libwbclient. so.0: cannot open shared object file: no such file or directory

2. Run ldconfig.

3. Assume that there is already a user name CJ in Linux, then:/usr/local/samba/bin/smbpasswd-a cj, then add CJ to SMB users.
(6) Start the smb service
Service iptables stop
Service Network restart
/Usr/local/samba/sbin/smbd-d
/Usr/local/samba/sbin/nmbd-d
(7) set the smb service to start upon startup.
VI/etc/rc. d/rc. Local
Add/usr/local/samba/sbin/smbd-d
/Usr/local/samba/sbin/nmbd-d
You can.
(8) At this time, no shared directory is set on our server. Next we will set a shared directory on the server:
# Mkdir/home/Public
# Chmod 777/home/Public
# Vi/usr/local/samba/lib/smb. conf
Move the cursor to the last line of the configuration file and add the following configuration below
# This is Samba text
[Text]
Comment = text
Path =/home/Public
Writable = Yes
Public = Yes
Log out, and restart the Samba server.

In addition:
The sambainstallation directory contains a docssub-directory with a samba-howto.pdf document, which is very detailed. The solution for displaying Chinese characters is solved only after reading this document.
Http://www.linuxsir.org/bbs/showthread.php? Postid = 1288908

 

(3) command example of ing Windows shared directory to Linux:

Mount-t cifs-O username = "Administrator", password = "123456" // 192.168.0.2/linuxdisk/home/cj

Mount-T smbfs-O username = "Administrator", password = "123456" // 192.168.0.2/linuxdisk/home/cj
The latter may be faulty. The error message is: Mount: Unknown filesystem type 'smbfs'
Rhel5 no longer supports smbfs, but instead replaces the original smbfs with the Common Internet File systemcifs (CIFS.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.