~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/utils/ecryptfs-setup-private

  • Committer: Dustin Kirkland
  • Date: 2009-10-14 19:49:58 UTC
  • Revision ID: kirkland@canonical.com-20091014194958-n5v0ib7zyrb1q1me
src/utils/ecryptfs-setup-private: fix bug where setup-private
incorrectly assumed that the home/private dir ownerships should
be owned by USER:USER; instead, default to USER:GROUP, where
GROUP is the USER's primary group by default, LP: #445301

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
        id "$USER" >/dev/null || error `gettext "User does not exist"` "[$USER]"
192
192
fi
193
193
 
 
194
# Obtain USER's primary group
 
195
GROUP=$(id -g $USER)
 
196
 
194
197
# Check if the ecryptfs group exists, and user is member of ecryptfs group
195
198
if grep -qs "^ecryptfs:" /etc/group; then
196
199
        if ! id "$USER" | grep -qs "\(ecryptfs\)"; then
410
413
        # and the calling 'adduser' is about to copy over /etc/skel
411
414
        # NOTE: it is the responsibility of 'adduser' to unmount!
412
415
        # And ensure that $USER owns the files/dirs we've created as root
413
 
        chown $USER:$USER "$CRYPTDIR" /dev/shm/.ecryptfs-$USER
414
 
        chown -R $USER:$USER $ECRYPTFS_DIR/$USER
415
 
        chown -R $USER:$USER $MOUNTPOINT
 
416
        chown $USER:$GROUP "$CRYPTDIR" /dev/shm/.ecryptfs-$USER
 
417
        chown -R $USER:$GROUP $ECRYPTFS_DIR/$USER
 
418
        chown -R $USER:$GROUP $MOUNTPOINT
416
419
        if [ "$FNEK" = "--fnek" ]; then
417
420
                fnek_sig=`tail -n 1 "$HOME/.ecryptfs/$PRIVATE_DIR.sig"`
418
421
                sig=`head -n 1 "$HOME/.ecryptfs/$PRIVATE_DIR.sig"`
424
427
        mount -i -t ecryptfs -o "rw,$sig_opt,ecryptfs_cipher=$CIPHER,ecryptfs_key_bytes=$KEYBYTES" "$CRYPTDIR" "$MOUNTPOINT" || error "Could not mount"
425
428
        ln -sf $ECRYPTFS_DIR/$USER/.ecryptfs $MOUNTPOINT/.ecryptfs
426
429
        ln -sf $ECRYPTFS_DIR/$USER/.$PRIVATE_DIR $MOUNTPOINT/.$PRIVATE_DIR
427
 
        chown -R $USER:$USER $ECRYPTFS_DIR/$USER
428
 
        chown -R $USER:$USER $MOUNTPOINT
 
430
        chown -R $USER:$GROUP $ECRYPTFS_DIR/$USER
 
431
        chown -R $USER:$GROUP $MOUNTPOINT
429
432
        exit 0
430
433
fi
431
434