Khanduras

Member
Jan 10, 2007
5
0
151
Say I'm wanting to give users shell access, and want all of the features of jailshell, however I would like to allow all jailshell users access to read a certain directory that jailshell does not normally allow access to. Is there any way I can set this up?

For instance - I'm running game servers from a machine. I would like to save plenty of hard drive space by shoving all of the required files into one directory, instead of in every directory for each server. I was thinking of putting them somewhere in /opt. However, when I shove them in /opt/serverfiles, none of the jailshell users have access to the files, no matter what permission is set on those files.

If someone could please tell me how to go about doing this if it's possible, or alternative methods of acomplishing the same goal, I would greatly appreciate it.
 

sparek-3

Well-Known Member
Aug 10, 2002
2,152
267
388
cPanel Access Level
Root Administrator
Proceed with caution in regards to this. I'm not sure if I would really recommend this or not, you may want to see if someone else will reply back and either confirm or deny this.

When users use jailshell a directory is created in /home/virtfs where the user is jailed to.

IMPORTANT: Do not delete the /home/virtfs directory or anything under this directory. If you delete anything in this directory it will kill your server. You have been warned.

If you need to give a user access to a directory from the jail shell environment, you can try copying that directory into the respective user in the /home/virtfs directory.

For example, if you have a username of earth and you want this user to have access to the /opt directory, then you could copy the /opt directory into the /home/virtfs/earth directory:

cp -r /opt /home/virtfs/earth

Please note, that if it /opt is very large then this will take up space on the /home partition of your server. And if you have multiple accounts that you want to access this area then you would have to copy this over for each user. Ideally, you would create hard links from /opt to /home/virtfs/earth but I do not know how to create directory hard-links. Not sure how the cPanel jailshell/virtfs does this.

Like I said, you may want to see if someone else can confirm if these steps work or if there are any possible side effects of taking these steps. This is just meant to be a suggestion and perhaps spark some conversation regarding this.
 

SoftDux

Well-Known Member
May 27, 2006
1,023
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
From the ln man page:

Code:
[B][[email protected] oostdco]# man ln[/B]


LN(1)                            User Commands                           LN(1)

NAME
       ln - make links between files

SYNOPSIS
       ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
       ln [OPTION]... TARGET                  (2nd form)
       ln [OPTION]... TARGET... DIRECTORY     (3rd form)
       ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

DESCRIPTION
       In  the  1st form, create a link to TARGET with the name LINK_NAME.  In the 2nd form,
       create a link to TARGET in the current directory.  In the 3rd and 4th  forms,  create
       links to each TARGET in DIRECTORY.  Create hard links by default, symbolic links with
       --symbolic.  When creating hard links, each TARGET must exist.
ln creates hardlinks by default, unless used with the -l option

So,
Code:
ln /opt/gamestuff /home/virtfs/gamestuff
will create a hardlink named /home/virtfs/gamestuff which will point to /opt/gamestuff.

I suggest you read through the man page of ln first. Whether or not this will work, I don't know.
 

vexil

Member
Apr 16, 2006
13
0
151
modify setupvirtfs

Can you modify setupvirtfs to automatically create hard links for all new user accounts?