Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux [2019/02/24 02:02] 127.0.0.1 external edit |
linux [2019/12/28 23:23] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Linux ====== | ====== Linux ====== | ||
- | Linux is a beautiful example of clean engineering. Form follows function. The | + | Linux is a beautiful example of clean engineering. Form follows function |
- | following is a collection of notes. | + | function follows coherent thoughts. The following is a collection of notes. |
+ | |||
+ | ===== Adding passwordless users ===== | ||
+ | |||
+ | To add a sudo user that doesn' | ||
+ | |||
+ | <code bash> | ||
+ | sudo adduser usernameyoulike | ||
+ | # give the user any temp password | ||
+ | # the following command removes the password | ||
+ | sudo passwd -d usernameyoulike | ||
+ | # add the user to the sudoers list | ||
+ | usermod -aG sudo usernameyoulike | ||
+ | </ | ||
===== udev ===== | ===== udev ===== | ||
- | I fell in a deep rabbit hole with udev whilst building Primo. Here is a | + | I fell in a deep rabbit hole with '' |
- | [[http:// | + | comprehensive guide about '' |
- | this]]. | + | |
- | To get all the information about a usb device: | + | To get all the information about a USB device: |
<code bash> | <code bash> | ||
Line 18: | Line 30: | ||
Some commands have changed since the bible has been written. | Some commands have changed since the bible has been written. | ||
- | To test, you can use the test function of udevadm. Problem is that you have to give | + | To test, you can use the test function of '' |
- | it the top level device path in sysfs. For example, an arduino plugged into | + | it the top level device path in '' |
- | Primo and showing up as ttyACM1, this was / | + | Primo and showing up as '' |
- | top level device path, use the command above and susbitute | + | '' |
+ | command above and substitute | ||
- | To test an arduino: | + | To test an Arduino: |
<code bash> | <code bash> | ||
udevadm test / | udevadm test / | ||
</ | </ | ||
- | To restart the udev system: | + | To restart the '' |
<code bash> | <code bash> | ||
sudo udevadm control --reload-rules && udevadm trigger | sudo udevadm control --reload-rules && udevadm trigger | ||
Line 35: | Line 48: | ||
You will still need to unplug/ | You will still need to unplug/ | ||
- | Some pittfalls | + | Some pitfalls |
- | symlinks to them. The symlink did not work for the tara uvc_camera. I think this is | + | symlinks to them. The symlink did not work for the Tara uvc_camera. I think this is |
- | issue has to do with the fact that the tara has some weird shit with the way the | + | issue has to do with the fact that the Tara has some weird shit with the way the |
USB host onboard handles the two cameras. | USB host onboard handles the two cameras. | ||
+ | |||
+ | Here's some other commands: | ||
+ | |||
+ | Lists the possible device attribute keys and their values along with the | ||
+ | parents of the device. | ||
+ | |||
+ | <code bash> | ||
+ | udevadm info --attribute-walk / | ||
+ | </ | ||
+ | |||
+ | Lists the device attributes and their values. | ||
+ | <code bash> | ||
+ | udevadm info -a /dev/video0 | ||
+ | </ | ||
+ | |||
+ | Reload udev rules | ||
+ | <code bash> | ||
+ | udevadm control --reload-rules && udevadm trigger | ||
+ | </ | ||
==== USB Information ==== | ==== USB Information ==== | ||
- | To get info on hidraw devices: | + | To get info on '' |
<code bash> | <code bash> | ||
Line 59: | Line 91: | ||
</ | </ | ||
- | When doing lsusb, use sudo!! If you don't, you won't be able to see devices whose | + | When doing '' |
permissions haven' | permissions haven' | ||
+ | |||
+ | Shows the USB version of the devices with that vendor id: | ||
+ | <code bash> | ||
+ | sudo lsusb -v | grep 2560 -A 10 | grep bcdUSB | ||
+ | </ | ||
===== cron ===== | ===== cron ===== | ||
Line 109: | Line 146: | ||
==== Terminal ==== | ==== Terminal ==== | ||
- | I use the xfce4-terminal. I have all nicely setup with a config file that resides in ~/ | + | I use the '' |
+ | that resides in '' | ||
===== Moving Windows ===== | ===== Moving Windows ===== | ||
Line 153: | Line 191: | ||
xubuntu (xfce) desktop. | xubuntu (xfce) desktop. | ||
- | using the x11 VNC server on the server. Port 5900 and 5901 | + | using the x11 VNC server on the server. Port 5900 and 5901. |
Running into security issues with the VNC server stuff. Tried: | Running into security issues with the VNC server stuff. Tried: | ||
Line 185: | Line 223: | ||
Problem is that it is slow. I don't think there is anything we can do it. It is also | Problem is that it is slow. I don't think there is anything we can do it. It is also | ||
- | slow through the lan. I've attributed this issue to running headless. | + | slow through the LAN. I've attributed this issue to running headless. |
===== Headless Operation ===== | ===== Headless Operation ===== | ||
Line 238: | Line 276: | ||
* . (dot command) same as source. This executes a list of commands. That is all. | * . (dot command) same as source. This executes a list of commands. That is all. | ||
* use ssh -X if you want to ssh with an X server | * use ssh -X if you want to ssh with an X server | ||
+ | |||
+ | To remove all files except for one in '' | ||
+ | |||
+ | <code bash> | ||
+ | setopt extendedglob | ||
+ | rm -- ^file.txt | ||
+ | </ | ||
==== Clipboard ===== | ==== Clipboard ===== | ||
Line 245: | Line 290: | ||
sudo apt install xclip | sudo apt install xclip | ||
cat file | xclip -selection clipboard | cat file | xclip -selection clipboard | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Window File Subsystem for Linux ====== | ||
+ | |||
+ | This thing is awesome! | ||
+ | |||
+ | For setting up ssh keys, xclip doesn' | ||
+ | <code bash> | ||
+ | clip.exe < ~/ | ||
+ | </ | ||
+ | |||
+ | ===== SSH Access ===== | ||
+ | |||
+ | For setting up external ssh access I did the following: | ||
+ | |||
+ | Reinstall openssh for some reason: | ||
+ | <code bash> | ||
+ | sudo apt-get purge openssh-server | ||
+ | sudo apt-get install openssh-server | ||
+ | </ | ||
+ | |||
+ | From an elevated powershell I ran this to change the port to 2222 to not | ||
+ | interfere with any windows services: | ||
+ | <code bash> | ||
+ | New-NetFirewallRule -DisplayName "Allow Inbound Port 2222" -Direction Inbound -LocalPort 2222 -Protocol TCP -Action Allow | ||
+ | </ | ||
+ | |||
+ | I added the following to sshd_config: | ||
+ | |||
+ | <code bash> | ||
+ | Port 2222 | ||
+ | PermitRootLogin no | ||
+ | AllowUsers paul | ||
+ | </ | ||
+ | |||
+ | I created an authorized hosts file and imported the keys. | ||
+ | |||
+ | I tested the connection by running this on the server: | ||
+ | <code bash> | ||
+ | sudo service ssh stop | ||
+ | sudo / | ||
+ | </ | ||
+ | |||
+ | Then on the client I ran a debug version of an ssh server to see if I was | ||
+ | receiving incoming connections. | ||
+ | <code bash> | ||
+ | ssh name@server -p 2222 | ||
+ | </ | ||
+ | |||
+ | I then monitored the server and make sure I could see the connection. The debug | ||
+ | client quit out cause it didn't have correct paths to the keys, but the test was | ||
+ | a success cause it validated the port pass through. I then restarted the regular | ||
+ | service like this: | ||
+ | |||
+ | <code bash> | ||
+ | sudo service ssh start | ||
</ | </ | ||