aboutsummaryrefslogtreecommitdiff
path: root/local/bin/usbkey
diff options
context:
space:
mode:
Diffstat (limited to 'local/bin/usbkey')
-rwxr-xr-xlocal/bin/usbkey4
1 files changed, 3 insertions, 1 deletions
diff --git a/local/bin/usbkey b/local/bin/usbkey
index 6d5115f..bab47df 100755
--- a/local/bin/usbkey
+++ b/local/bin/usbkey
@@ -121,12 +121,14 @@ op_ssh_generate() {
op_ssh_import() {
check_name
check_mount || op_mount
- if [ -f "$MOUNT_PATH/ssh/$NAME" ] && [ -f "$MOUNT_PATH/ssh/$NAME.pub" ]; then
+ if [ ! -f "$MOUNT_PATH/ssh/$NAME" ] || [ ! -f "$MOUNT_PATH/ssh/$NAME.pub" ]; then
echo "There is no key named $NAME" >&2
exit 1
fi
cp "$MOUNT_PATH/ssh/$NAME" ~/.ssh/
cp "$MOUNT_PATH/ssh/$NAME.pub" ~/.ssh/
+ chmod 600 ~/.ssh/"$NAME"
+ chmod 640 ~/.ssh/"$NAME.pub"
echo "SSH key $NAME copied to local .ssh directory." >&2
}