Score:1

Zipping content from another users dir with out the root dir being included

ru flag

I have the following dir structure.

/home/bradley/data/ {whole bunch of files and dirs}

I want to zip up the content but not include /home/bradley in the archive. So I have tried this.

cd /home/bradley/ && sudo zip -FS -r -b /tmp /home/0-backup/users/bradley.zip *

This does work. However, the script that runs this command is run as a different user with sudo privileges. You can't do sudo cd /home/bradley. Not permitted.

I tried sudo -D /home/bradley zip -FS -r -b /tmp /home/0-backup/users/bradley.zip * but I get the error sudo: you are not permitted to use the -D option with /usr/bin/zip.

I am not sure where to go to next. Any thoughts would be greatly appreciated.

Score:1
ru flag

ok, took reading the man page of sudo... here is the correct way to do it.

sudo sh -c "cd /home/bradley; zip -FS -r -b /tmp /home/0-backup/users/brdley.zip *"

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.