[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: backing up



On 28/05/12 04:31 AM, Chris Davies wrote:
Frank McCormick<debianlist@videotron.ca>  wrote:
    Just for fun I created a new user (my wife)..and ran a session under
"her" account...she could not write to my directory so nothing happened.
This whole thread has convinced me I need to learn more about bash and
scripting :)

It's not difficult [*] to check what userid the PostSession script
runs as, and it is definitely root. So your script will backup your
thunderbird directory (as root) regardless of who logs out.

For a generic solution you could try creating this as your
PostSession/Default:

     #!/bin/sh
     #
     # PostSession
     #
     GDM_USER_FILE="$HOME/.gdm_postsession"

     if test -x "$GDM_USER_FILE"
     then
	cd "$HOME"
	su "$LOGNAME" "$GDM_USER_FILE"
     fi
     exit 0

And then you can put your custom commands in your own .gdm_postsession
file, in your home directory. (Don't forget to make it executable).


What I ended up doing was to add the -p parameter to cp to ensure attributes were maintained. Also added -u to only update changed files




--
Cheers
Frank


Reply to: