Restrict users to their home directory in VSFTP
Sometimes you may want to restrict users to their home directory while doing FTP. You can achieve this in VSFTP with the following steps.
1. Open the VSFTPD configuration file “/etc/vsftpd.conf” . Uncomment the following lines.
chroot_local_user=YES
chroot_list_file=/etc/vsftpd.chroot_list
2. Create the file “/etc/vsftpd.chroot_list” and place the user names (one per line) that you want to restrict in that file.
3. Restart VSFTPD to take effect.
/etc/init.d/vsftpd restart
After this users listed in the file “/etc/vsftpd.chroot_list” will be locked up in their home directory.
Tags: directory, home, Restrict, users, VSFTP
Ftp error “553 Disk full - please upload later”
Problem: You get the ftp error “553 Disk full - please upload later”, even when the quota of the user has not been exceeded and the disk partition in which all the user accounts reside (say /dev/sda5) is not full.
Cause: The value of the variable ‘MaxDiskUsage’ in the pure-ftpd configuration file (/etc/pure-ftpd.conf ) will be equal to or less than the percent use of the partition.
——————————————–
root@ [~]# grep MaxDiskUsage /etc/pure-ftpd.conf
MaxDiskUsage 90
——————————————–
#df
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 144G 59G 78G 90% /
——————————————–
Solution: Change the MaxDiskUsage value to 99 (Some high value) and restart pure-ftpd.
Tags: 553 Disk full, Ftp error
Configuring FTP server for passive mode.
The common issue faced while running FTP in passive mode is the firewall.
Usually, in FTP servers like pure-ftp, the Passive Port Range can be specified in its configuration file itself.
But, if the Passive Port Range isn’t specified, the server uses the locally available ports for FTP.
These port ranges are specified in /proc/sys/net/ipv4/ip_local_port_range file.
Please follow the below method so that the ports remain constant and FTP runs smoothly.
1. Configure sysctl and set the port range in /etc/sysctl.conf as, net.ipv4.ip_local_port_range
2. sysctl -p would load the new kernel values.
3 Open the port range specified above in your firewall.
Tags: FTP, passive mode
Adding user/group in a FreeBSD server
How do I add a user and group to the FreeBSD Server?:
The ‘pw’ command can be used to add a user and or group to the FreeBSD System. The ‘pw’ command is a program that will allow any user with superuser privileges to edit and or add users and groups on FreeBSD with ease. It also allows a way to standardize modification of adding and removing users and groups.
This would create the group ‘anewgroup’ to the machine.
Now to add a users ‘ben’ to the ‘anewgroup’ using pw, issue the following command.
pw useradd ben -s /bin/csh -g anewgroup
This command would create the user ben, with a shell of /bin/csh and add it to the anewgroup group. The user would also have his home directory under /home/ben.
Now say, if the user needs to have the home directory on a different partition, for example /mnt/test/home issue the following command.
pw useradd ben -d /mnt/test/home/ben -s /bin/csh/ -g anewgroup
If the user ‘ben’ is to be added to a secondary group on the system, say a group that has been created already called ‘oldgroup’, then execute the following.
pw usermod ben -G oldgroup
Tags: Adding, FreeBSD, server, user/group
Steps to upgrade MySQL in FreeBSD
Steps to upgrade MySQL version 4 to 5 in the FreeBSD :
1. Backup the existing MySQL database.
$ cd /var/db/
$ tar cvfz mysql.tar.gz mysql
2. Stop the MySQL service.
$ /usr/local/etc/rc.d/mysql-server.sh stop
3.Remove the existing MySQL Server .
pkg_delete mysql-server-4.*.*
pkg_delete mysql-client-4.*.*
Replace the ‘*’ with the version that is the server.
4. For installing the new MySQL Server, execute the following step.
$ cd /usr/ports/databases/mysql50-server && make install clean
5.Start MySQL 5.0 in the server and run the upgrade script.
$ /usr/local/etc/rc.d/mysql-server.sh start
$ /usr/local/bin/mysql_upgrade -u root -p –datadir=/var/db/mysql
You will be prompted for the new MySQL password where you can provide it.
Tags: FreeBSD, mySQL, upgrade