mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-12 07:46:28 +00:00
tomb forge: useless sudo and chown
Depending script invokation, behavior is not exactly similar. Assuming that if SUDO_USER is set, the _sudo invokation can be dropped (EUID=0). In the other case, user has created file, owner is already good, don't call chown. Preparation: $ tomb dig foo.tomb -s 10 Method 1: $ sudo tomb forge foo.tomb.key -v Method 2: $ tomb forge foo.tomb.key -v ... ask user password to gain superuser privileges ... Sorry, user <username> is not allowed to execute '/bin/chown <uid>:<gid> foo.tomb.key' as root on <hostname>. Signed-off-by: Matthieu Crapet <mcrapet@gmail.com>
This commit is contained in:
parent
99f10bf215
commit
02812f4c06
2
tomb
2
tomb
@ -1955,7 +1955,7 @@ forge_key() {
|
|||||||
_failure "Operation aborted."
|
_failure "Operation aborted."
|
||||||
}
|
}
|
||||||
|
|
||||||
_sudo chown ${_UID}:${_GID} "$TOMBKEYFILE"
|
[[ -n $SUDO_USER ]] && chown ${_UID}:${_GID} "$TOMBKEYFILE"
|
||||||
_message "Done forging ::1 key file::" $TOMBKEYFILE
|
_message "Done forging ::1 key file::" $TOMBKEYFILE
|
||||||
_success "Your key is ready:"
|
_success "Your key is ready:"
|
||||||
ls -lh $TOMBKEYFILE
|
ls -lh $TOMBKEYFILE
|
||||||
|
Loading…
Reference in New Issue
Block a user