From f506431973585ef15196aefd409c3f94474a0468 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Tue, 12 Sep 2023 20:02:09 +0200 Subject: Update mount scripts plus some cleanup. --- src/bin/mount-a | 9 --------- src/bin/mount-b | 9 --------- src/bin/mount-c | 9 --------- src/bin/mount-c1 | 4 ++++ src/bin/umount-a | 4 ---- src/bin/umount-b | 4 ---- src/bin/umount-c | 3 +-- src/sudo/etc-sudoers.txt | 13 +++++++++++++ 8 files changed, 18 insertions(+), 37 deletions(-) delete mode 100644 src/bin/mount-a delete mode 100644 src/bin/mount-b delete mode 100644 src/bin/mount-c create mode 100644 src/bin/mount-c1 delete mode 100644 src/bin/umount-a delete mode 100644 src/bin/umount-b create mode 100644 src/sudo/etc-sudoers.txt diff --git a/src/bin/mount-a b/src/bin/mount-a deleted file mode 100644 index 72bc6cc..0000000 --- a/src/bin/mount-a +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [[ $# -lt 1 ]] ; then - echo -e "usage:\t$(basename $0) deviceToMount" -else - echo sudo mount -o gid=`id -g`,uid=`id -u` $1 /mnt/a/ - sudo mount -o gid=`id -g`,uid=`id -u` $1 /mnt/a/ -fi - diff --git a/src/bin/mount-b b/src/bin/mount-b deleted file mode 100644 index 91108f1..0000000 --- a/src/bin/mount-b +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [[ $# -lt 1 ]] ; then - echo -e "usage:\t$(basename $0) deviceToMount" -else - echo sudo mount -o gid=`id -g`,uid=`id -u` $1 /mnt/b/ - sudo mount -o gid=`id -g`,uid=`id -u` $1 /mnt/b/ -fi - diff --git a/src/bin/mount-c b/src/bin/mount-c deleted file mode 100644 index 7b76e5f..0000000 --- a/src/bin/mount-c +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [[ $# -lt 1 ]] ; then - echo -e "usage:\t$(basename $0) deviceToMount" -else - echo sudo mount -o gid=`id -g`,uid=`id -u` $1 /mnt/c/ - sudo mount -o gid=`id -g`,uid=`id -u` $1 /mnt/c/ -fi - diff --git a/src/bin/mount-c1 b/src/bin/mount-c1 new file mode 100644 index 0000000..45da8c3 --- /dev/null +++ b/src/bin/mount-c1 @@ -0,0 +1,4 @@ +#!/bin/sh + +echo mount -o uid=`id -u`,gid=`id -g`,noatime,noexec /dev/sdc1 /mnt/c/ +sudo mount -o uid=`id -u`,gid=`id -g`,noatime,noexec /dev/sdc1 /mnt/c/ diff --git a/src/bin/umount-a b/src/bin/umount-a deleted file mode 100644 index 16b8dc6..0000000 --- a/src/bin/umount-a +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -sudo umount /mnt/a - diff --git a/src/bin/umount-b b/src/bin/umount-b deleted file mode 100644 index a4c8113..0000000 --- a/src/bin/umount-b +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -sudo umount /mnt/b - diff --git a/src/bin/umount-c b/src/bin/umount-c index 3ea510e..54647dc 100644 --- a/src/bin/umount-c +++ b/src/bin/umount-c @@ -1,4 +1,3 @@ -#!/bin/bash +#!/bin/sh sudo umount /mnt/c - diff --git a/src/sudo/etc-sudoers.txt b/src/sudo/etc-sudoers.txt new file mode 100644 index 0000000..ab69ea5 --- /dev/null +++ b/src/sudo/etc-sudoers.txt @@ -0,0 +1,13 @@ + +Cmnd_Alias CMD_POWEROFF = /sbin/poweroff "" +Cmnd_Alias CMD_MOUNT_C1 = /usr/bin/mount -o "uid=1000\,gid=1000,noatime,noexec" /dev/sdc1 /mnt/[abcdefghijklmnopqrstuvwxyz] + +# MUST be BELOW the "%sudo" line !!!!!!!! +alice ALL=(root) NOPASSWD: CMD_POWEROFF +alice ALL=(root) NOPASSWD: CMD_MOUNT_C1 + + +## Links + +# Syntax "https://unix.stackexchange.com/a/18880/292722" + -- cgit v1.1 From cf9b11e3cb2ebc5878d80e247ba2376bc788367e Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 21 Oct 2023 13:14:54 +0200 Subject: (xorg) add oneliner for convenience. --- src/xorg/_xinitrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/xorg/_xinitrc b/src/xorg/_xinitrc index e0ff5de..841baea 100644 --- a/src/xorg/_xinitrc +++ b/src/xorg/_xinitrc @@ -7,5 +7,8 @@ xset s off # screensaver xset -dpms # disable DPMS (Energy Star) features xset s noblank # don't blank the video device +# Or as a CopyPasta oneliner: +# xset s off && xset -dpms && xset s noblank + exec /etc/alternatives/x-session-manager -- cgit v1.1 From f45403e67c9a32fada75219534574520de7c01ea Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 21 Oct 2023 13:43:04 +0200 Subject: (git) How to push/pull from multiple remotes. --- src/git/_gitconfig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/git/_gitconfig b/src/git/_gitconfig index b2dcb56..83cf455 100644 --- a/src/git/_gitconfig +++ b/src/git/_gitconfig @@ -49,3 +49,12 @@ #[core] # pager = less -R -+X +# How to push to multiple remotes in one go: +# git push all --dry-run --all +# [remote "all"] +# pushurl = user@ONE.example.com:foo/bar.git +# pushurl = user@TWO.example.com:foo/bar.git + +# How to fetch from multiple remotes (but NOT all!) in one go: +# git fetch --multiple origin upstream + -- cgit v1.1 From 7333ac4abe0723cbe53636feac37a4de2c790146 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 21 Oct 2023 16:29:15 +0200 Subject: (ssh) Forward X11 via ssh config --- src/ssh/config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ssh/config b/src/ssh/config index d5cebfc..159d1f9 100644 --- a/src/ssh/config +++ b/src/ssh/config @@ -26,6 +26,10 @@ Host 192.168.56.* StrictHostKeyChecking no UserKnownHostsFile /dev/null +# Forward X11 by default +Host example.com + ForwardX11 yes + # Run few setup cmds before starting a shell. Host example.com RequestTTY yes -- cgit v1.1