6

First of all is it a good idea?

Anyway i have a couple of users who we have log into a local web server, but they need to navigate to the /var/www folder each time on log in via terminal.

Is it possible to change the users home folder to the www folder instead.

Also for them to also use the same .aliases file i created?

The users will log in via the terminal for the mac or putty on a windows machine. Basically for use to run commands like gulp npm etc.

They will also use or I will set up Samba so they can add files etc.

  • 2
    Do you need to change their home folders or is it enough to just have them start in /var/www automatically? – terdon Aug 22 '16 at 15:11
  • I'm not so sure this is a good idea. Some files will be created in their $HOME, like for example when they use ssh. For example in .ssh/known_hosts. It would be better if you try to explain what exactly you try to achieve and what these users need to do in /var/www ? For example, if they're developers, give each of them a separate vhost to work on and use some version control in a central repository (git, cvs or svn ). – jawtheshark Aug 22 '16 at 15:16
  • I like @terdons idea. Add cd /var/www to their respective $HOME/.profile files. That said, this is bound to cause permission issues all over the place. – jawtheshark Aug 22 '16 at 15:18
  • just have them start in /var/www @jawtheshark, they'll use basic PW rather that ssh to log in via shell, just nice for them to log in to the folder they mainly be working in, i used to have an aliase call sites, but if this even saves them typing anythign straight away – Simon Davies Aug 22 '16 at 15:24
  • So probably better to just add the alias to it for each user? FYI i've set them up with ACL permission for folders within www etc – Simon Davies Aug 22 '16 at 15:25
15

If you just need them to start their sessions in /var/www by default, you don't want to change their $HOME (which is a bad idea anyway since /var/www won't belong to them). A much cleaner approach is to add this to their ~/.profile files:

cd /var/www

As for the aliases, all you need to do is modify their ~/.profile files to source the alias file you've created. Add this line to each user's ~/.profile:

. /path/to/.aliases

This way, they'll move to /var/www each time they log in (since login shells load ~/.profile) and they'll also have access to the aliases defined in /path/to/.aliases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.