Sym links in home folder

General support questions
Post Reply
draccusfli
Posts: 2
Joined: 2019/11/04 11:43:56

Sym links in home folder

Post by draccusfli » 2019/11/04 11:50:41

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?

User avatar
jlehtone
Posts: 2432
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Sym links in home folder

Post by jlehtone » 2019/11/04 12:14:53

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.)

draccusfli
Posts: 2
Joined: 2019/11/04 11:43:56

Re: Sym links in home folder

Post by draccusfli » 2019/11/04 13:11:02

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.

User avatar
TrevorH
Forum Moderator
Posts: 27156
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Sym links in home folder

Post by TrevorH » 2019/11/04 13:43:43

Why not just use /usr/local/bin in the first place? That's already path of $PATH.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
CentOS 5 has been EOL for nearly 3 years and should no longer be used for anything!
Full time Geek, part time moderator. Use the FAQ Luke

anthonynorth
Posts: 7
Joined: 2019/11/01 17:21:30
Location: Brighton, UK

Re: Sym links in home folder

Post by anthonynorth » 2019/11/04 17:37:24

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".

User avatar
jlehtone
Posts: 2432
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Sym links in home folder

Post by jlehtone » 2019/11/04 18:37:38

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 ...

Post Reply

Return to “CentOS 7 - General Support”