![]() But first, we need to add that group sudo addgroup -system sftp Save the file and reload the SSH service to sudo service ssh reloadĪfter modifying OpenSSH we need to modify our chrooted web user accounts to have the sftp group as a secondary group. …and finally add this block to the end of the file (where sftp is the name of the group that restricts the users to SFTP access) Match group sftp …and find the line Subsystem sftp /usr/libexec/openssh/sftp-serverĬhange the line so i reads Subsystem sftp internal-sftp Open the sshd_config file sudo nano /etc/ssh/sshd_config It should work out of the box but you need to change a some things to get the right file permissions when using suPHP. SFTP is a secure way of transferring your files to and from your server. Now it is time to set up SFTP so it works with suPHP and gives the files you upload the correct permissions. If you try to use SSH to access the site you should be denied. Remember to restart Apache for the change to become effective udo a2dismod mod_name Chroot users and enable SFTP Once completed restart Apache sudo service apache2 restart We need the rewrite module so let’s go on and enable that sudo a2enmod rewrite To see what is already enabled type this ls /etc/apache2/mods-enabled To see available modules type this command ls /etc/apache2/mods-available Enable or disable Apache moduelsĪpache comes with a bunch of modules that just need to be enabled. Once you have completed the above steps and reloaded Apache using sudo service apache2 reload you should be able to visit the site on it’s IP and see the content of the file you have made on /var/Likewise, you should be able to visit the individual sites you have made using their URL. Now you want to disable the nf file sudo a2dissite nf Once you have saved the document you should enabled it using the a2ensite command sudo a2ensite nf # Possible values include: debug, info, notice, warn, error, crit,ĬustomLog /var/www/localhost/logs/access.log combined ServerAdmin /var/www/localhost/public_htmlĮrrorLog /var/www/localhost/logs/error.log Furthermore, comment out or remove the ServerName so the document looks like this Open the file and change all occurrences of with localhost. I have chosen to make a nf file sudo cp /etc/apache2/sites-available/ /etc/apache2/sites-available/nf You can either make a nf file or edit the nf file. Remeber to create af file like this for each of your domains including localhost.įor the localhost (which shows the site when the public IP is entered in the browser) user it seems like Apache takes the first enabled site. ![]() as any modern browser will automatically do so for you. But currently, there is nothing on these sites so go on, and create an index.html in each of the public_html folders like this sudo nano /var/write something in each of the – e.g. You should now be able to access your sites on the domains you have made virtual host files for. Now restart Apache sudo service apache2 restart To enable each site enter this command for each domain like this sudo a2ensite …and then edit the newly created file to change everywhere the domain name occurs. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatchĮrrorLog /var/# Possible values include: debug, info, notice, warn, error, crit,įor other domains you can now copy this file like this sudo cp /etc/apache2/sites-available/ /etc/apache2/sites-available/ Options Indexes FollowSymLinks MultiViews #ServerAlias - change this if you wish to map to ServerAdmin /var/ htaccess files be sure to set AllowOverride to All in you home directory (in this case /var/ It should look something like this – just replace the domain everywhere it occurs. Now go and edit the file sudo nano /etc/apache2/sites-available/ It might just be called nf in other environments. I like to have one for each of my domains but you should be fine if you like to have all your setup in the same file sudo cp /etc/apache2/sites-available/nf /etc/apache2/sites-available/ To set up a virtual host copy the default virtual host file. With a virtual host you tell Apache to host different sites on different places on your server. Sudo usermod -s /bin/false Add Virtual Host Run the following commands to add new user with a home directory that is a copy of the /var/-m -k "/var/sudo passwd Sudo chown -Rv localhost:localhost /var/www/localhostĭisable shell access as we only want these users to have access via SFTP – see more on this later sudo usermod localhost -s /bin/false Create additional users sudo useradd -d /var/www/localhost -m localhostĬreate default directory cd /var/www/localhost Run the following commands that creates the user localhost as well as set home directory and password for it. ![]() Create localhost user and default directory skeleton Right now, all pages will be under the /var/www/html/ folder.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |