mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 14:13:52 +03:00
Backport #25721 by @wolfogre
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: Jason Song <i@wolfogre.com>
(cherry picked from commit e6801df99c
)
This commit is contained in:
parent
b01fb88728
commit
493a45615d
1 changed files with 9 additions and 1 deletions
|
@ -2,7 +2,15 @@
|
||||||
|
|
||||||
if [ ! -d /data/git/.ssh ]; then
|
if [ ! -d /data/git/.ssh ]; then
|
||||||
mkdir -p /data/git/.ssh
|
mkdir -p /data/git/.ssh
|
||||||
chmod 700 /data/git/.ssh
|
fi
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
chmod 700 /data/git/.ssh
|
||||||
|
if [ -f /data/git/.ssh/authorized_keys ]; then
|
||||||
|
chmod 600 /data/git/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f /data/git/.ssh/environment ]; then
|
if [ ! -f /data/git/.ssh/environment ]; then
|
||||||
|
|
Loading…
Reference in a new issue