You are not logged in.
Hi,
I have a folder with some files I want to permanent share with a friend. I thought that if I added him as a user with that folder as his home directory he would be able to read and write to the folder.
The thing is that the files resides on a disk that is mounted
mount /dev/sde /mnt/media
So I added him as a user
useradd -d /mnt/media/ tmg
and added the user to users group.
I added him to usersAllow in sshd_config.
and was meet by this message
Could not chdir to home directory /mnt/media/: Permission denied
and found myself logged into /
The disk is owned by me and belongs to the users group. A chmod -R a+w did not resolve anything.
What am I missing?
Last edited by odp (2013-10-30 00:19:49)
Offline
mount /dev/sde /mnt/media
I think that this is a permissions issue on the /mnt/media folder itself, because you would have to use root rights to create /mnt/media (since /mnt is owned by root). Have you checked the permissions of /mnt/media before you mounted anything?
Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository
Offline
Also, why is it trying to chroot? Have you set it up this way? Is he using ssh or is it sftp? What exactly is in your sshd_config?
Basically, you need to clarify your question better, and provide all the useful details you can. We cannot be expected to guess at what your issue is here.
Offline
It's not trying to chroot, unless I've missed something.
If the user does not have (at least) execute permissions on it's home directory and the parent directories leading to the home directory, then the user will get dumped to /.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
odp wrote:mount /dev/sde /mnt/media
I think that this is a permissions issue on the /mnt/media folder itself, because you would have to use root rights to create /mnt/media (since /mnt is owned by root). Have you checked the permissions of /mnt/media before you mounted anything?
I just checked and /mnt/media is set to
drwxrwxrwx 2 root root 4096 Dec 13 2012 /mnt/media/
so it is owned by root
chown -R me:users media did not change it though
Offline
Also, why is it trying to chroot? Have you set it up this way? Is he using ssh or is it sftp? What exactly is in your sshd_config?
Basically, you need to clarify your question better, and provide all the useful details you can. We cannot be expected to guess at what your issue is here.
I am pretty much using the default configuration. sshd_config states: #ChrootDirectory none
Offline
It's not trying to chroot, unless I've missed something.
If the user does not have (at least) execute permissions on it's home directory and the parent directories leading to the home directory, then the user will get dumped to /.
Ok, that makes sense and describes my problem pretty well, WonderWoof you concure?
Offline
chown -R me:users media
did not change it though
I don't think that would change it, as I doubt it you are actually pointing it to the directory in question. Try
chown -R me:users /mnt/media
About this:
WorMzy wrote:It's not trying to chroot, unless I've missed something.
If the user does not have (at least) execute permissions on it's home directory and the parent directories leading to the home directory, then the user will get dumped to /.
Ok, that makes sense and describes my problem pretty well, WonderWoof you concure?
I concur with @WorMzy's statement.
Last edited by clfarron4 (2013-10-29 23:12:33)
Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository
Offline
So if the users 'me' and 'tmg' are both members of the group 'users'.
And if the disk has these permissions drwx-w--w- 25 me users 4096 Aug 23 02:38 /mnt/media/
Then what is the correct way of mounting the disk?
Further do I have to do do anything to prepare the disk or directory for mounting, like chmod,chown?
Offline
odp wrote:chown -R me:users media
did not change it though
I don't think that would change it, as I doubt it you are actually pointing it to the directory in question. Try
chown -R me:users /mnt/media
About this:
odp wrote:WorMzy wrote:It's not trying to chroot, unless I've missed something.
If the user does not have (at least) execute permissions on it's home directory and the parent directories leading to the home directory, then the user will get dumped to /.
Ok, that makes sense and describes my problem pretty well, WonderWoof you concure?
I concur with @WorMzy's statement.
I believe we are all on the same page then
Offline
Whoops... read it too fast and what chdir as chroot in the error mesage. My bad.
That being the case, I am going to have to go with permissions being the issue as well.
Offline
chown -R me:users /mnt/media
did not change the error when logging in:
Could not chdir to home directory /mnt/media/: Permission denied
drwx-w--w- 25 me users 4096 Aug 23 02:38 /mnt/media/
Last edited by odp (2013-10-29 23:17:54)
Offline
The permissions on that folder are rwx for everyone, so I doubt that's causing problems. Besides, judging by the ls output, I'd guess that this is an NTFS partition, so chown/chmod/etc. would have no affect (as NTFS doesn't support UNIX file permissions/ownership).
What are the permissions on /mnt and /?
EDIT, okay, now they're not?
Colud you clarify what filesystem the partition is using?
Last edited by WorMzy (2013-10-29 23:20:06)
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
it's ext4
EDIT:
/mnt/
is owned by root but me and tmg can see the content
Last edited by odp (2013-10-29 23:30:37)
Offline
I'm confused by the permissions changing.. the original permissions were 'drwxrwxrwx root root', which would be fine (albeit horribly insecure), but now they're 'drwx-w--w- me users'? The problem now is that the users group doesn't have execute permissions on the folder, so they can't transverse into the directory, only "me" has sufficient permissions. Since the filesystem is ext4, you should be able to use chmod to add (+) execute (x) to the group (g) permissions. I trust you're sufficiently knowledgeable to generate the correct command for this purpose, using the information I've just provided. If not, read up on 'man chmod'.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Please change the thread's subject line to something more descriptive, such as "ssh permissions with home directory in /mnt/". "ssh:" alone is not informative.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
one step further. I guess this is related to sshd.
/usr/bin/xauth: file /mnt/media/music/.Xauthority does not exist
as if im passing a -X when ssh'ing as tmg
Offline
So now the user's home directory is /mnt/media/music? Why does this user need to run X apps if you're just sharing files?
I think the goalposts keep moving here..
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Please change the thread's subject line to something more descriptive, such as "ssh permissions with home directory in /mnt/". "ssh:" alone is not informative.
duely noted. This is a mistake as I typed in something more descriptive to begin with,
Offline
So now the user's home directory is /mnt/media/music? Why does this user need to run X apps if you're just sharing files?
I think the goalposts keep moving here..
This user does not need to use X apps at all. That is why I say that this must have to do with sshd_config
regarding the music part. I should be able to ssh into any dir in 'my' home directory, am I right?
Even if I just play it clean and just ssh into the home directory I am left with the Xauth error, which I find odd
Last edited by odp (2013-10-30 00:07:12)
Offline
WorMzy wrote:So now the user's home directory is /mnt/media/music? Why does this user need to run X apps if you're just sharing files?
I think the goalposts keep moving here..
This user does not need to use X apps at all.
Then why are you using -X?
I should be able to ssh into any dir in 'my' home directory, am I right?
How are you sshing into a specific directory? This is not something I have ever done, so I'm not sure how it works.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I created an overwrite rule for user tmg in sshd_config to disable X11 forwarding. This solved the last error.
Now everything seems to work swell.
Thanks for everyones help here,
Now I'll test and see if the settings are pesistant is unmount mount scenarios, reboots etc.
Marking as solved.
Offline
How are you sshing into a specific directory? This is not something I have ever done, so I'm not sure how it works.
append -t '(cd directory;/bin/bash)'
It will open a bash shell in the specified directory
Offline
Please use the edit button to append information to your previous post when there are no intervening posts. This and other matters are addressed in the forum etiquette linked in my sig.
Anyway, glad that you managed to solve this.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Hm, I've never thought of using the -t flag in that manner. If it works for you, then it works for you. Personally, I don't see any advantage over ssh-ing, then cd-ing.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline