CentOS 7 - sshd: permission denied on authorized_keys if users home folder is on another partition

I have a problem that drives me crazy ... I try to fix this for at least 2 hours - and I was not very successful.

The problem itself: I installed CentoS7 (I donโ€™t know if this is the specific behavior of CentOs 7) on a virtual machine that should host our git and gitolite environment. I installed the necessary services and users. Everything is working fine, and I can connect via SSH with a password and key based verification. All users have a home directory in / home /. Now I would like to add a new user (git) with / srv / data / home / git (/ srv on a separate partition) as the home directory and enable key based authentication. Both sections are formatted in ext4 format.

grep git /etc/passwd
git:x:1000:1000::/srv/data/home/git:/bin/bash

I installed gitolit and created the user according to the official documentation:

su - git 
mkdir -p ~/.ssh
chmod 700 ~/.ssh
mkdir gitclone-dir 
cd gitclone-dir
git clone git://github.com/sitaramc/gitolite
cd gitclone-dir
gitolite/install -ln ~/bin
gitolite setup -pk /srv/data/home/git/.ssh/git_admin.pub

The output of the githolite tuning command:

git /srv/data/home/ git/repositories/gitolite-admin.git/ git /srv/data/home/ git/repositories/testing.git/ :/srv/data/home/ git/.ssh/authorized_keys ;  ( )

gitolite-admin, :

marcel@mw-ws:~/Sources/juwimm_git/ayeq-benu$ git ls-remote git@192.168.10.35:gitolite-admin.git
git@192.168.10.35 password: 
X11 forwarding request failed on channel 0
fatal: 'gitolite-admin.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

, , debug3: http://pastebin.com/eiZSTu55

:

Jul 18 17:45:40 bh-infra-s010 sshd[2739]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Jul 18 17:45:40 bh-infra-s010 sshd[2739]: debug1: trying public key file /srv/data/home/git/.ssh/authorized_keys
Jul 18 17:45:40 bh-infra-s010 sshd[2739]: debug1: Could not open authorized keys '/srv/data/home/git/.ssh/authorized_keys': Permission denied

:

su - root 
cat /srv/data/home/git/.ssh/authorized_keys 
# the statement above works fine and I see the files content on the command line 
su - git
cat /srv/data/home/git/.ssh/authorized_keys 
# with the same result. It working fine

. :  - /home/testuser , .ssh -. : !  - /srv/testuser 2 , . : authorized_keys  - /home/testuserls .ssh. /home/testuser 3 /home/testuserls /etc/passwd, /home/testuser 3 . : !  - /srv/testuser 4 , .ssh /home/testuser 4 /srv/testuser4 /etc/passwd, /home/testuser 4. :

ls -l /srv/data/home/git/.ssh/

:

total 16
-rw-------. 1 git git 1108 Jul 18 16:28 authorized_keys
-rw-------. 1 git git 1679 Jul 18 13:31 id_rsa
-rw-------. 1 git git  399 Jul 18 13:31 id_rsa.pub

, . CentOS7? ? ssh openssh-server-6.4p1-8.el7.x86_64? Google - ... !

I ( ) ext4. /etc/mtab:

/dev/vda1 /boot ext4 rw,seclabel,relatime,data=ordered 0 0 
/dev/vda2 / ext4 rw,seclabel,relatime,data=ordered 0 0 
/dev/vdb1 /srv ext4 rw,seclabel,relatime,data=ordered 0 0 

ACL. , ? UID 1000 - UID git.

grep git /etc/passwd git:x:1000:1000::/srv/data/home/git:/bin/bash

, /

/srv: drwxr-xr-x. 10 root root 4096 Jul 18 16:48 srv 
/srv/data: drwxr-xr-x. 3 root root 4096 Jul 18 12:25 data 
/srv/data/home: drwxr-xr-x. 4 root root 4096 Jul 18 16:45 home 
/srv/data/home/git: drwx------. 7 git git 4096 Jul 18 15:30 git 
/srv/data/home/git/.ssh: drwxr-----. 2 git git 4096 Jul 18 16:40 .ssh 

** II - **

, selinux . โ€‹โ€‹ .ssh-Folder:

chcon -R --type=ssh_home_t .ssh 
+4

All Articles