Content
How do you download backup files as a sudoer but not root?
Hi,
Ubuntu 22.04 LTS, VPS.
Newest OP Community Ed.
I have turned off logging in as a root via SSH.
Now it appears, as a sudoer XY, from VPS I can't download to my PC a backup folder content via FTP client (WinSCP in that case). Permissions thing pops up. I can enter the folder though, as a sudoer XY.
Hence, kindly, I have three questions:
- what are correct, default permissions for backup folder, and its content? (I messed up a bit manually).
- who should be the owner of that folder and its content, only 'openproject' or could it be any sudoer? (It's also tricky here: one set of backup is owned by me as a sudoer XY, and despite I log in via FTP as a sudoer XY I still cannot download, same message pops up).
- is it possible at all to download the content of a backup folder as any other user than root?
Will be very grateful for any help.
Cheers,
Piotr
Replies (2)
Robinson, thanks a lot for taking the time to reply.
Backups on VPS are done via cron by root.
I have root privileges too. But for security reasons, as mentioned, root via SSH is turned off, by me. For now, I don't want to use it, as I did for years.
I used working script via WinSCP, .BAT which starts now, and then stops because of the permissions problem, I think (this script worked fine for years when I used root account to download).
I used to run this script automatically on my PC via Task Scheduler every morning, before the problem with permissions appeared:
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/ini=nul ^
/command ^
"open sftp://non-root-sudoer@domain.com:port#/ -hostkey=""ssh-###"" -privatekey=""G:\path\to\keys keys SSH\key.ppk"" -passphrase=""x"" -rawsettings PingType=X AgentFwd=X AuthKI=X" ^
"cd /var/db/openproject/backup" ^
"lcd ""G:\path\to\myPC\backupfolder""" ^
"get -preservetime *" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%
But I understand that basically, it is all about non-root-sudoer permissions: backup folder and files.
Do you know the exact chmod number which I should set up?
This is what I have got for the folder (the only possible from drop-down list owners are root and openproject):
And this is what I get for the files in the folder (the only owners available from the drop-down list are non-root-sudoer and openproject):
Do you have any ideas how to set it correctly?
I will be very grateful for any clues.
Cheers,
Piotr
Robinson Taylor wrote:
Solved.
I should have downloaded all as openproject user.
Sorry for bothering.
Piotr