You are not logged in.

#1 2013-10-29 22:45:31

odp
Member
Registered: 2012-04-26
Posts: 136

[SOLVED] ssh permissions with home directory in /mnt/

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

#2 2013-10-29 22:52:36

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,165
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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?


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

#3 2013-10-29 22:57:20

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#4 2013-10-29 23:06:14

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,642
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#5 2013-10-29 23:06:29

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

clfarron4 wrote:
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

#6 2013-10-29 23:08:05

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

WonderWoofy wrote:

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

#7 2013-10-29 23:09:29

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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?

Offline

#8 2013-10-29 23:10:48

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,165
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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.

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

#9 2013-10-29 23:13:46

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#10 2013-10-29 23:15:05

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

clfarron4 wrote:
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 smile

Offline

#11 2013-10-29 23:16:36

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#12 2013-10-29 23:17:10

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#13 2013-10-29 23:18:38

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,642
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#14 2013-10-29 23:29:16

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#15 2013-10-29 23:49:19

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,642
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#16 2013-10-29 23:54:24

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#17 2013-10-29 23:58:27

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#18 2013-10-30 00:02:14

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,642
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#19 2013-10-30 00:02:39

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

Xyne wrote:

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

#20 2013-10-30 00:05:54

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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. That is why I say that this must have to do with sshd_config smile

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

#21 2013-10-30 00:12:09

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,642
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

odp wrote:
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

#22 2013-10-30 00:12:58

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#23 2013-10-30 00:21:32

odp
Member
Registered: 2012-04-26
Posts: 136

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

#24 2013-10-30 00:24:27

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#25 2013-10-30 00:31:32

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,642
Website

Re: [SOLVED] ssh permissions with home directory in /mnt/

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

Board footer

Powered by FluxBB