mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
rpm: set proper permissions for /var/lib/sftpgo and /srv/sftpgo
it seems we have to check the permissions after each update, probably because nfpm defines these dirs as empty folders
This commit is contained in:
@@ -29,14 +29,13 @@ if [ "$1" = "configure" ]; then
|
|||||||
echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
|
echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check permissions for /srv/sftpgo and adjust them if needed
|
# we added /srv/sftpgo after 1.1.0, we should check if we are upgrading
|
||||||
|
# from this version but a non-recursive chmod/chown shouldn't hurt
|
||||||
if [ -d /srv/sftpgo ]; then
|
if [ -d /srv/sftpgo ]; then
|
||||||
if [ $(stat -c '%U' /srv/sftpgo) != sftpgo ]; then
|
chown sftpgo:sftpgo /srv/sftpgo
|
||||||
echo "Set permissions for /srv/sftpgo"
|
chmod 750 /srv/sftpgo
|
||||||
chown -R sftpgo:sftpgo /srv/sftpgo
|
|
||||||
chmod 750 /srv/sftpgo
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#DEBHELPER#
|
#DEBHELPER#
|
||||||
|
|||||||
@@ -29,14 +29,13 @@ if [ "$1" = "configure" ]; then
|
|||||||
echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
|
echo "Please be sure to have the python3-requests package installed if you want to use the REST API CLI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check permissions for /srv/sftpgo and adjust them if needed
|
# we added /srv/sftpgo after 1.1.0, we should check if we are upgrading
|
||||||
|
# from this version but a non-recursive chmod/chown shouldn't hurt
|
||||||
if [ -d /srv/sftpgo ]; then
|
if [ -d /srv/sftpgo ]; then
|
||||||
if [ $(stat -c '%U' /srv/sftpgo) != sftpgo ]; then
|
chown sftpgo:sftpgo /srv/sftpgo
|
||||||
echo "Set permissions for /srv/sftpgo"
|
chmod 750 /srv/sftpgo
|
||||||
chown -R sftpgo:sftpgo /srv/sftpgo
|
|
||||||
chmod 750 /srv/sftpgo
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||||
|
|||||||
@@ -22,13 +22,15 @@ if [ $1 -eq 1 ]; then
|
|||||||
/bin/echo "Please be sure to have the python requests library installed if you want to use the REST API CLI"
|
/bin/echo "Please be sure to have the python requests library installed if you want to use the REST API CLI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check permissions for /srv/sftpgo and adjust them if needed
|
# adjust permissions for /srv/sftpgo and /var/lib/sftpgo
|
||||||
if [ -d /srv/sftpgo ]; then
|
if [ -d /srv/sftpgo ]; then
|
||||||
if [ $(/usr/bin/stat -c '%U' /srv/sftpgo) != sftpgo ]; then
|
/usr/bin/chown sftpgo:sftpgo /srv/sftpgo
|
||||||
/bin/echo "Set permissions for /srv/sftpgo"
|
|
||||||
/usr/bin/chown -R sftpgo:sftpgo /srv/sftpgo
|
|
||||||
/usr/bin/chmod 750 /srv/sftpgo
|
/usr/bin/chmod 750 /srv/sftpgo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d /var/lib/sftpgo ]; then
|
||||||
|
/usr/bin/chown sftpgo:sftpgo /var/lib/sftpgo
|
||||||
|
/usr/bin/chmod 750 /var/lib/sftpgo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# reload to pick up any changes to systemd files
|
# reload to pick up any changes to systemd files
|
||||||
|
|||||||
Reference in New Issue
Block a user