Creating FTP User
cd /var/www/vhosts/ (Path of vhosts directory)
useradd newUser -d /var/www/vhosts/ -G apache (newUser: Name of user to be added)
passwd newUser
Password: ****
ReType Password: ****
Giving Permissions to new FTP user
cd /var/www/vhosts/DirName (Dirname: Directory name – Giving permissions to user ‘newUser’ for accessing particular directory)
chown newUser.apache * -R
Giving Permissions to new User on Particular domain
#chown userName:userName /var/www/vhosts/.com
#chmod 755 /var/www/vhosts/.com
#chown -R userName:userName ***.com/
Creating MySql database and User
Run below commands on database server.
MySql
mysql> show databases;
mysql> CREATE DATABASE DbName; (DbName: Name of the database)
mysql> GRANT ALL ON DbName.* TO ‘DbUser’@’%’ IDENTIFIED BY ‘DbPassword’;
Create MySql user
#CREATE USER ‘USER’@’localhost’ IDENTIFIED BY ‘PASSWORD’;
#GRANT ALL PRIVILEGES ON * . * TO ‘USER’@’localhost’;
Backup of Database
#mysqldump -u DbUsername -p DatabaseName > dump.sql (dump.sql: Backup file name)
After hitting Enter, you will be prompted for Database Password.
Exporting of Database
mysql -u DbUsername -p DatabaseName < dump.sql
After hitting Enter, you will be prompted for Database Password.
Creating SSH User
#adduser –home /var/www/vhosts/.com userName (.com: Domain name; userName: Name of the user)
#passwd userName
Password: ****
Re-type Password: ****
Make the directory writable for Apache
chown -R www-data:www-data /var/www/directoryName/
Change the owner of a file
chown <owner> <file name>
Change the group of a file
chown :<group name> <file name>
Change both owner and the group
chown <owner>:<group name> <file name>
Change the owner/group of the files in a directory (recursively)
chown -R <owner>:<group name> <directory path>