Skip to content

Commit 5b7b7c4

Browse files
wolfogreGiteaBot
andauthored
Correct permissions for .ssh and authorized_keys (#25721)
Set the correct permissions on the .ssh directory and authorized_keys file, or sshd will refuse to use them and lead to clone/push/pull failures. It could happen when users have copied their data to a new volume and changed the file permission by accident, and it would be very hard to troubleshoot unless users know how to check the logs of sshd which is started by s6. Co-authored-by: Giteabot <[email protected]>
1 parent 45ac90e commit 5b7b7c4

File tree

1 file changed

+9
-1
lines changed
  • docker/root/etc/s6/gitea

1 file changed

+9
-1
lines changed

docker/root/etc/s6/gitea/setup

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
if [ ! -d /data/git/.ssh ]; then
44
mkdir -p /data/git/.ssh
5-
chmod 700 /data/git/.ssh
5+
fi
6+
7+
# Set the correct permissions on the .ssh directory and authorized_keys file,
8+
# or sshd will refuse to use them and lead to clone/push/pull failures.
9+
# It could happen when users have copied their data to a new volume and changed the file permission by accident,
10+
# and it would be very hard to troubleshoot unless users know how to check the logs of sshd which is started by s6.
11+
chmod 700 /data/git/.ssh
12+
if [ -f /data/git/.ssh/authorized_keys ]; then
13+
chmod 600 /data/git/.ssh/authorized_keys
614
fi
715

816
if [ ! -f /data/git/.ssh/environment ]; then

0 commit comments

Comments
 (0)