From: Thomas Walker Lynch Date: Sat, 19 Mar 2022 15:48:58 +0000 (+0100) Subject: . X-Git-Url: https://git.reasoningtechnology.com/style/static/gitweb.js?a=commitdiff_plain;h=33c058d403cd156f20a4fa8cd462badbc501937f;p=subu . --- diff --git a/document/cant_access_bus.txt b/document/cant_access_bus.txt new file mode 100644 index 0000000..dfb250d --- /dev/null +++ b/document/cant_access_bus.txt @@ -0,0 +1,4 @@ + +after changing to the new user: + +> export NO_AT_BRIDGE=1 diff --git a/document/dir-structure.txt b/document/dir-structure.txt deleted file mode 100644 index b385074..0000000 --- a/document/dir-structure.txt +++ /dev/null @@ -1,38 +0,0 @@ - -~ is the project directory - --------------------------------------------------------------------------------- -most subdirectories are source modules - - --------------------------------------------------------------------------------- -~/tools - -Some tools are normally installed on the system. Others are local. Local tools -are typically standard tools that have been customized for the project or are -unusual to the project. - - ~/tools/bin is for the executables of locally used tools. - ~/tools/lib is locally used libraries. - ~/tools/doc is for collected docs on tools - -typically a developer will want ~/tools/bin in his search path - --------------------------------------------------------------------------------- -~/staged - -These are make file build targets. They represent either intermediate or -finished executables and libraries. When a project has multiple src -directories and they use each other's work product for the builds, the -items in the staged area are those that are used by each src directory. - -Typically the install target copies material in the staging area to -system locations. - --------------------------------------------------------------------------------- -~/ - - - - - diff --git a/document/file_extentions.txt b/document/file_extentions.txt deleted file mode 100644 index a9a2b21..0000000 --- a/document/file_extentions.txt +++ /dev/null @@ -1,23 +0,0 @@ - - -filename.tag.extension - -extension: - .c for C source - .cc for C++ source - .h for C header file - .hh for C++ header file - .o an object file - -tag: - .lib. The resulting .o file to be placed in release library and is part of the - programming interface. - .aux. The resulting.o file not directly part of the programming interface, but - it might be called by functions that are. - .cli. The source file has a main call and is to be relased as part of the command line interface - .loc. file has a main call to be made into a local uitlity function - -We carry the source file tag and extension to the .o file. We do not put tags -nor extensions on command line executables. - -local_common.h should be included in all source files diff --git a/document/makefile-issue b/document/makefile-issue deleted file mode 100644 index 8916de0..0000000 --- a/document/makefile-issue +++ /dev/null @@ -1,21 +0,0 @@ -1. - -For the following makefile, the .PHONY tag is ignored unless there -is an explicit target with that name. The %:: target is not enough. -So for expample, if there is an exec directory, the exec target -caught through the %:: will never fire. The commented lines must -be added that give an explicit exec target. - - -.PHONY: all version deps lib exec -all: version deps lib exec - -lib: - $(MAKE) $@ - cp src/tranche.lib.h include/tranche.h - -#exec: -# $(MAKE) $@ - -%:: - $(MAKE) $@ diff --git a/document/note.txt b/document/note.txt index b9ed603..3cdd7d7 100644 --- a/document/note.txt +++ b/document/note.txt @@ -1,4 +1,6 @@ +this does not apply to the current scripts, but rather the setuid code + subu-mk-0 1. We have to make the subu for step 2 so that we will have subu_uid and subu_gid diff --git a/document/sound.txt b/document/sound.txt new file mode 100644 index 0000000..0a02f87 --- /dev/null +++ b/document/sound.txt @@ -0,0 +1,28 @@ + +before changing users: + +user must be in group audio + +> sudo dnf install pulseaudio-utils +> pactl load-module module-native-protocol-tcp + +after changing users: + +> export PULSE_SERVER=localhost + +According to +https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/CLI/#default.pa +the module load command goes in /etc/pulse/default.pa and the pactl command is not needed, +but this did not work: + + /etc/pulse/default.pa + load-module module-native-protocol-tcp + +this did not work +seems this must be run by the login user, not even root can do it: + + pactl load-module module-native-protocol-tcp + +also requires restart of google-chrome etc. + +for now I will add this the .bashrc file for admin diff --git a/document/usb.txt b/document/usb.txt new file mode 100644 index 0000000..4e62275 --- /dev/null +++ b/document/usb.txt @@ -0,0 +1,18 @@ + + +added file /etc/udev/rules/50-usb-scale.rules +SUBSYSTEM=="usb" ,ATTR{idVendor}=="1d50" ,ATTR{idProduct}=="60fc" ,MODE="0666" ,OWNER="Thomas-Internet" + +SUBSYSTEM=="usb" \ +,ATTR{idVendor}=="1d50" \ +,ATTR{idProduct}=="60fc" \ +,MODE="0666" \ +,OWNER="Thomas-Internet" + + +udevadm control --reload-rules +udevadm control --reload-rules && udevadm trigger + +systemctl status systemd-udevd + +firefox can find the usb hardward key with these settings, google-chrome can not. diff --git a/document/video.txt b/document/video.txt new file mode 100644 index 0000000..e60e4f0 --- /dev/null +++ b/document/video.txt @@ -0,0 +1,6 @@ + +user must be in group video + +I added 666 permissions to udev for the USB camera but doubt this +is needed. + diff --git a/executable/ch_subu b/executable/ch_subu deleted file mode 100755 index 8b8150b..0000000 --- a/executable/ch_subu +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# - -# to make audio work will need to do this: -# > sudo dnf install pulseaudio-utils -# > pactl load-module module-native-protocol-tcp -# To load a specific module to the PA server, you add it to /etc/pulse/default.pa: -# I created the file because it was not there... - -#set -x - -subu=$1 - -if [ ! -x "/usr/local/bin/user-stem" ]; then - echo "no /usr/local/bin/user-stem program found (it is in the system repo)" - exit 1 -fi - -if [ -z "$subu" ]; then - echo "no subuser name supplied" - exit 1 -fi - -machine="$(hostname)" -xkey=$(xauth list | grep "$machine" | head -1 | awk '{print $3}') - -if [ -z "$xkey" ]; then - echo "xauth key not found" - exit 1 -fi - -stem=$(/usr/local/bin/user-stem) -user_subu="$stem-$subu" -home_subu="/home/$stem/$subu" -bashrc="$home_subu/.bashrc" -xauthority="$home_subu/.Xauthority" - -read -r -d '' script0 <<-EOF - cd "$home_subu" \ - ;export DISPLAY=$DISPLAY \ - ;export NO_AT_BRIDGE=1 \ - ;export PULSE_SERVER=localhost \ - ;touch "$xauthority" \ - ;xauth add "$DISPLAY" . "$xkey" \ - ;gnome-terminal -EOF - -sudo su "$user_subu" -c "$script0" - -#set +x diff --git a/executable/subu_env b/executable/subu_env new file mode 100755 index 0000000..b54968e --- /dev/null +++ b/executable/subu_env @@ -0,0 +1,54 @@ +#!/bin/bash +# + +# to make audio work will need to do this: +# > sudo dnf install pulseaudio-utils +# > pactl load-module module-native-protocol-tcp +# To load a specific module to the PA server, you add it to /etc/pulse/default.pa: +# I created the file because it was not there... + +#set -x + +subu=$1 + +if [ ! -x "/usr/local/bin/user-stem" ]; then + echo "no /usr/local/bin/user-stem program found (it is in the system repo)" + exit 1 +fi + +if [ -z "$subu" ]; then + echo "no subuser name supplied" + exit 1 +fi + +machine="$(hostname)" +xkey=$(xauth list | grep "$machine" | head -1 | awk '{print $3}') + +if [ -z "$xkey" ]; then + echo "xauth key not found" + exit 1 +fi + +stem=$(/usr/local/bin/user-stem) +user_subu="$stem-$subu" +home_subu="/home/$stem/$subu" +bashrc="$home_subu/.bashrc" +xauthority="$home_subu/.Xauthority" + +read -r -d '' script0 <<-EOF + cd "$home_subu" \ + ;export DISPLAY=$DISPLAY \ + ;export NO_AT_BRIDGE=1 \ + ;export PULSE_SERVER=localhost \ + ;touch "$xauthority" \ + ;xauth add "$DISPLAY" . "$xkey" \ + ;gnome-terminal +EOF + + +sudo su -l "$user_subu" -c "$script0" + +#just hangs +#sudo -u "$user_subu" sh -c "$script0" + +#set +x