Page 1 of 1

Sym links in home folder

Posted: 2019/11/04 11:50:41
by draccusfli
I am setting up a network automation box using Centos 7 and python 3.6 where users will log in to run various scripts from a folder called scripts that sits in the root of /home.

When new users log in I want to "map" the /home/scripts folder using a symbolic link into their personal home folder. I can do this manually easily enough, however, who wants to have to do it manually?

Any thoughts or help appreciated?

Re: Sym links in home folder

Posted: 2019/11/04 12:14:53
by jlehtone
Why a link? If you have executable scripts, then the /home/scripts could be on the PATH.


When you create a new user, you do create a homedir too, don't you?
The default with 'useradd' is to copy contents of skeleton directory into the new home.
If the skeleton contains a symlink ...
(although, I don't know whether useradd dereferences the link and would thus copy whole dir.)

Re: Sym links in home folder

Posted: 2019/11/04 13:11:02
by draccusfli
Hi jlehtone

Sorry, I missed an important piece of information, vital some might say. The VM is windows joined to a Windows domain and users log in with their domain accounts based on group membership, as such users' home folders are created when they first login, this negates the need to use useradd to create new users.

However, adding /home/scripts on the PATH could be a good option, though below the /scripts folder there are subdirs containing the .py files required for each application.

Re: Sym links in home folder

Posted: 2019/11/04 13:43:43
by TrevorH
Why not just use /usr/local/bin in the first place? That's already path of $PATH.

Re: Sym links in home folder

Posted: 2019/11/04 17:37:24
by anthonynorth
Don't forget if you add /home/scripts to the PATH then you will need to change the way those .py files are included in the subdirs. i.e. use a full-path include "/home/scripts/subdir/file.py".

Re: Sym links in home folder

Posted: 2019/11/04 18:37:38
by jlehtone
draccusfli wrote:
2019/11/04 13:11:02
users' home folders are created when they first login
That sounds like pam_mkhomedir. It does use that same skeleton ...