- Step 1: Make sure you can execute commands as root on the remote host after logging in, without entering your password. For this there are two alternative options:
- You can allow the user to execute sudo without entring the users password. You can do this by adding the following line to the end of /etc/sudoers:
ALL=NOPASSWD: ALL - You can enter the sudo password in advance once and make sure it is cached between sessions. To make sure it is cached between sessions you must add the '!tty_tickets' option to the Defaults line in /etc/sudoers, and then you must run a dummy command as root:
- Defaults env_reset,!tty_tickets
- ssh -p PORT
-t USER @REMOTE_HOST sudo id - Step 2: Do the rsync. Override the ssh port. Specify "sudo rsync" as remote rsync command. Target the rsync at the non-root user which can now sudo:
- sudo rsync -avRe "ssh -p PORT
" --rsync-path "sudo rsync" LOCAL_DIR USER @REMOTE_HOST :
2014-10-03
Copy files using rsync as root when the remote host does not allow root access and ssh is on a different port
2014-09-29
Ubuntu Linux: Show network throughput of network device eth0 etc in bytes: iftop -B
By default iftop shows the bandwidth in Bit/s
iftop
To show the bandwidth in Bytes/s
iftop -B
iftop
To show the bandwidth in Bytes/s
iftop -B
2014-08-11
Quit screen on german keyboard
On a german keyboard the key binding for 'quit' on GNU screen does not seem to work for me (on Max OS X). But one can simply invoke the quite command directly through the command mode:
- Ctrl-A : quit
Save screen scrollback buffer to file
Type:
- Ctrl-A : hardcopy -h file.txt
For me this saves a lot of leading blank lines, but this is ok.
2014-08-03
2014-04-30
Strip PDF restrictions on Mac OS X without any special tools
Assuming you have a PDF which has certain restrictions on it (for example you cannot edit the PDF using Preview in the usual way), but which you can print, this is how you can strip these restrictions from the PDF:
- open the Printer Queue for your Printer
- stop the Queue
- print the PDF
- now you should have a file starting with 'd' under /var/spool/cups which is an unprotected version of your PDF
- in Terminal type sudo cp /var/spool/cups/d* ~/Desktop/d.pdf
- this assumes there is just one file starting with a 'd' which is usually the case. If there are multiple files pick one by one until you have your file.
- in Terminal type sudo chown foo:foo ~/Desktop/d.pdf (replace foo with your actual user name)
- file ~/Desktop/d.pdf does not have any restrictions
- in the Printer Queue delete the print job
- start the Printer Queue
Note that this procedure does not allow you to strip passwords from files which you cannot print without a password. The restricted file must at least allow you to print the file.
2014-02-26
Mac OS X Lion: Scan for wireless networks
Mac OS X Lion provides a command line tool to scan for wireless networks and print useful information about the networks:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s
Also, to see additional information about the currently active wireless connection hold down the Option key while clicking on the Airport Symbol in the menu bar.
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s
Also, to see additional information about the currently active wireless connection hold down the Option key while clicking on the Airport Symbol in the menu bar.
2014-02-17
Common bashrc settings
There are my personal preferences. Your preferences may differ.
alias e=jed alias mv="mv -i" alias cp="cp -i" alias rm="rm -i" complete -r export LANG=C export EDITOR=jed export PATH=$PATH:${HOME}/bin
2014-02-07
Zotac Zbox ID18 Linux Server
- Zotac Zbox ID18
- Samsung SSD 840 EVO 1TB
- 4GB RAM (SODIMM 1600)
- Ubuntu 13.10
Samsung SSD firmware update: The process is quite broken:
- download the 'Windows' Firmware update for the 840 EVO
- mount it
- dd the btdsk.img onto a USB stick
- put the USB stick into the Zotac
- change the Zotac BIOS so it boots from the USB stick
- reboot
- ignore all error messages about missing partitions
- eventually the Samsung Firmware Update program comes up
- take note of the Firmware revision
- follow the instructions of the program
- wait
- ignore the message about power cycling the SSD, since you cannot power cycle it in isolation
- ignore the message about the firmware update being unsuccessful
- reboot (still from the USB stick)
- check that you have the new firmware revision
- Linux shows: ata1.00: ATA-9: Samsung SSD 840 EVO 1TB, EXT0BB6Q, max UDMA/133)
The installation of Ubuntu is quite straight forward.
Recommended settings after installation:
- Enable TRIM support and avoid unnecessary writes when reading files and dirs:
- /etc/fstab:
- UUID=
/ ext4 discard,noatime,errors=remount-ro 0 1 - Reduce amount of disk space reserved for root from 45GB to 1GB:
- sudo tune2fs /dev/sda1 -m 0.1
- Install sshd:
- sudo apt-get install openssh-server
- Install 'sensors' to check the CPU temp:
- sudo apt-get install lm-sensors
- sudo sensors-detect
- sudo service kmod start
- sensors
- Install 'smartmontools' to see the SSD temp and other interesting data:
- sudo apt-get install smartmontools
- sudo smartctl -x /dev/sda | grep -i 'Current Temp'
- Do not start GUI/X
- edit /etc/default/grub:
- #GRUB_HIDDEN_TIMEOUT=0
- GRUB_TIMEOUT=1
- GRUB_CMDLINE_LINUX_DEFAULT="text"
- sudo jed /etc/default/grub
- sudo update-grub
- I like to install:
- sudo apt-get install jed apcalc screen minidlna openssh-server samba emacs ispell subversion g++ imagemagick
- If you have a couple of minutes:
- sudo apt-get update
- sudo apt-get upgrade
- If you would like to manually TRIM the SSD:
- sudo fstrim -v /
- Install SAMBA:
- sudo apt-get install samba
- see https://help.ubuntu.com/12.04/serverguide/samba-fileserver.html
[zotti]
comment = Share on the Zotac
path = /zotti
browsable = yes
guest ok = yes
read only = no
create mask = 0777
veto files = /.*.pdf/.*.jpg/.DS_Store/._.DS_Store/.*.ini/.*.txt/.*.mov/.*.avi/.*.mpg/.*.png/
delete veto files = yes
hide dot files = yes
hide unreadable = yes
2014-02-03
jed settings for indent=4, just spaces, line numbers on, sane brace insertion
My favorite jed setting in $HOME/.jedrc
USE_TABS = 0; LINENUMBERS = 2; % For the following to work you _must_ comment out any c_set_style() call! C_INDENT = 4; C_BRACE = 0; C_BRA_NEWLINE = 0; C_Colon_Offset = 0; C_CONTINUED_OFFSET = 4; public variable C_Class_Offset = 4;
Abonnieren
Posts (Atom)