Generate random password on Linux terminal

Jan 21, 2017
This just a log for me (& may be others) to remind me how to generate random passwords on Linux terminal. pwgen is a useful command which can generate both pronounceable and secure passwords. There a few other creative ways to generate random text/password on linux terminal, but pwgen is specially designed for the task and is the most handy. The usage is quite simple:
pwgen [ OPTIONS ] [ pw_length ] [ num_pw ] By default, pwgen generates pronounceable passwords. For secure password use -s option. The pwgen man page describes more options. Here are some example outputs:

Generate 6 random (pronounceable) passwords of length 20. $ pwgen 20 6 fei7hohS9co6ahkua2ei chaiFoo2eaLedei9Oosi Ainuu5eehie5ae1eecae co6quahbaiPahSh1good fah6Daer7geepae0teef queeLahl9us7sushawie
Generate 6 random (secure) passwords of length 20. $ pwgen -s 20 6 PTbQ8Nc8gIJ5sHrKM0gS pMI8R8KK0MrnCd4UCEhe 25KcqpYiQTOFYf7PHwoN ztClxu7CQiOOVPgNJFHa yKnc1obXyXLvmPmLAVWA L1fMNHRRHiC2MNWS6j2Z
Generate 6 random passwords of length 20 with special characters. $ pwgen -y 20 6 EN5eb2eyuz2ohNgir}ei yah>l9ainohWah8afaiJ Jue-dah3quoo8wee9foh ul)eoWie3Ees;aeh(ees pheehie+Zanahw~eiP5g dath5oozaht0fei&F4Xi
Generate 6 random (secure) passwords of length 20 with special characters. $ pwgen -s -y 20 6 JSt]pL1UV)`u>Rz%;]Ei yx-sWF#pm_ci?(w|D0pd [#W%%E%oP7vQ~U%?#L<9 :~Y:Z?LH''aHH&A$zJ4w zZ5vZH+ABm!k;S_b^#cb c"zpT6l1HI_"ENSuNAkw
Lastly, here is the pwgen help text: $ pwgen --help Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ] Options supported by pwgen: -c or --capitalize Include at least one capital letter in the password -A or --no-capitalize Don't include capital letters in the password -n or --numerals Include at least one number in the password -0 or --no-numerals Don't include numbers in the password -y or --symbols Include at least one special symbol in the password -s or --secure Generate completely random passwords -B or --ambiguous Don't include ambiguous characters in the password -h or --help Print a help message -H or --sha1=path/to/file[#seed] Use sha1 hash of given file as a (not so) random generator -C Print the generated passwords in columns -1 Don't print the generated passwords in columns -v or --no-vowels Do not use any vowels so as to avoid accidental nasty words
Read more ...

TeamViewer initctl start fail on Linux

Sep 11, 2015
Tested on: Linux Mint 17.1 Rebecca (Ubuntu 14.04.1 LTS) with TeamViewer 10.0.46203

TeamViewer is great! But it keeps a daemon running in background, which may not be very desirable for occasional users. The daemon can be disabled by running: $ teamviewer daemon disable tee: /opt/teamviewer/logfiles/install_teamviewerd.log: Permission denied Fri Sep 11 14:12:42 PDT 2015 Action: Removing ... initctl stop teamviewerd initctl: Unknown instance: fail rm: cannot remove ‘/etc/init/teamviewerd.conf’: Permission denied initctl: Rejected send message, 1 matched rules; type="method_call", sender=":1.113" (uid=1000 pid=22111 comm="initctl reload-configuration ") interface="com.ubuntu.Upstart0_6" member="ReloadConfiguration" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") OK, using sudo seems to do the trick: $ sudo teamviewer daemon disable Fri Sep 11 14:14:55 PDT 2015 Action: Removing ... initctl stop teamviewerd initctl: Unknown instance: fail wine: /home/username/.config/teamviewer10 is not owned by you
After disabling daemon, TeamViewer shows following error message when started, which is expected. However, the daemon fails to start when the command is executed:

$ sudo teamviewer daemon start initctl start teamviewerd initctl: Unknown job: teamviewerd fail $ sudo teamviewer --daemon start initctl start teamviewerd initctl: Unknown job: teamviewerd fail initctl is not aware of teamviewerd, probably because /etc/init/teamviewerd.conf was deleted during the daemon disable command (see above). Reinstalling teamviewer makes it work, but that's not the best solution.

After looking into some more details, following command can be used to start the daemon (open TeamViewer as usual after this and Ctrl-C to kill the daemon): $ sudo /opt/teamviewer/tv_bin/teamviewerd -f
For reference, initial content of /etc/init/teamviewerd.conf can be found in /opt/teamviewer/tv_bin/script/teamviewerd.DEB.conf, which can also be modified and copied to correct location. Also see this Github discussion and this blog post for more details.
Read more ...

tikz.sty not found

May 12, 2015
Tested on: Linux Mint 17.1 Rebecca (Ubuntu 14.04 LTS - Trusty Tahr)

This error with pdflatex has been mystery to me for a long time. Surprisingly, it is not easy to find a clear solution online.
ERROR: LaTeX Error: File `tikz.sty' not found. --- TeX said --- Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty)

Solution

sudo apt-get install texlive-pictures pgf
Installation of the package pgf is the most important bit! Without pgf LaTeX will keep complaining that tikz.sty is missing. This solution was also proposed in a comment on stackexchange:

... The pgf package, as I keep forgetting and remembering every year, is independently installed from the pictures (which includes tikz but it's not loaded unless pgf is present) extras, the common, and the main tex on 'ix systems.


Read more ...

Connecting to USC Secure Wireless on Linux

Dec 23, 2014
Tested on: Ubuntu 14.04, Linux Mint 17, Linux Mint 17.1

USC (Univ. of Southern California) updated its wireless service to have an encrypted and faster connection available to USC faculty, staff, and students with name 'USC Secure Wireless'. Unfortunately for students like me, USC did not document how to use Linux computers with this service.

Following configuration has worked for me to connect to USC Secure Wireless during past couple of months. The basic idea is to use 'WAP2' or 'WAP Enterprise' security and use Protected EAP (PEAP) authentication along with GTC as secondary authentication. Same idea works on Android phones as well.

Create a new connection by right-clicking on 'Network connection' icon in notification area and choosing 'Edit Connections...' It will pop a 'Network connection' window. Click on the 'Add' button on the right side and choose 'Wi-Fi' as connection type. Then follow the settings described in the images below (click on the images to enlarge them). Note that the USC-id must be entered without @usc.edu.



And here is how the connection information looks like after being connected to USC Secure wireless.



Read more ...