Author: stamatis

SUDO extra functionality in /etc/sudoers.d/

Say our username is mike and our host is alpha To add specific commands (say /bin/binary1 and /bin/binary2) that we would be able to run through sudo without a password, we can do the following: Run sudo visudo -f /etc/sudoers.d/mike and add the following to it: mike alpha=(root:root) NOPASSWD: /bin/binary1,/bin/binary2

Solstice Disk Suite / Solaris Volume Manager

Create State Database (3 database replicas on 4 slices (12 state replicas): metadb -a -f -c 3 c0t1d2s3 1 c1t2d3s4 c2t3d4s5 c3t4d5c6 Create 1 concatenated volume from 4 slices: metainit dxx 4 1 c0t1d2s3 1 c1t2d3s4 1 c2t3d4s5 c3t4d5c6 Create 2 striped volumes from 3 slices with 32k interleave: metainit dxx 2 3 c0t1d2s3 c1t2d3s4 c2t3d4s5 -i 32k Create 2 striped volumes from 3 slices: metainit dxx 2 3 c0t1d2s3 c1t2d3s4 c2t3d4s5 Create a RAID 5 volume from 4 slices: metainit dxx -r c0t1d2s3 c1t2d3s4 c2t3d4s5 c3t4d5s6

Linux Serial Terminal (Hard-wired Host To Host)

Say we have a host alpha and a host bravo that is connected to alpha with serial cable. The following entries are required within /etc/inittab of the host alpha (to make the configuration permanent): T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100 Next, re-read the /etc/inittab of host alpha by running: init q From host bravo, connect with: cu -l ttyS0 -e -o -115200

Quick keyboard layout setting

Say you want to use an additional layout on your keyboard in a terminal, to support Hellenic (gr) along with your English (gb) layout, and also want to be able to switch layouts with <Shift> + <CapsLock> and have the [Scroll Lock] LED light up when the second layout is active In your terminal or console session, run setxkbmap -option grp:switch,grp:shift_caps_toggle,grp_led:scroll gb,gr

X Terminal setup with XDM

The XClient / XServer model, is in a nutshell described as follows: XServer: Is the host that will display the session (also called X-Terminal). Only requires the X11 system to be installed and optionally a display manager (no desktop or window manager are necessary). The Xserver can be invoked by a number of ways: From the command line as root, run: “X :1 -query xclientHost” In the /etc/X11/xdm/Xservers add the following: “:1 local /usr/X11R6/bin/X :1 -query xclient-host” XClient: Is the host that will export its display to the XServer (X-Terminal). Requires a desktop / window manager and optionally a display manager. The following files need modification as follows: /etc/X11/xdm/Xaccess: *.your-domain.ext *.your-domain.ext CHOOSER BROADCAST /etc/X11/xdm/xdm-config: !DisplayManager.requestPort: 0 /etc/X11/xdm/Xservers: #:0 local /usr/X11/bin/X :0 vt9 -depth 15 -nolisten tcp

Configure language switching on keyboard

Say we want to add the Hellenic (el) keyboard layout in X11. Edit /etc/X11/xorg.conf and add the following entries Option “XkbLayout” “gb,el” # British, Hellenic Option “XkbOptions” “grp:alt_shift_toggle” # Switch with Alt-Shift Log out / in your X session and try out the configuration by pressing <Alt>+<Shift>

SUDO installation and configuration

Install the sudo package using your system’s package manager (Gdebi, synaptic, aptitude, apt-get, yum, rpm, or whichever package manager is available on your system) In a terminal (which we’ll refer to as root terminal from now on), run su to log in as root, and then run: egrep -e ‘sudo|wheel’ /etc/group to determine if group sudo or wheel (or even both) exist on your system If the output is like: sudo:x:27: we can go ahead and add ourselves to it by running in the root terminal: usermod -a -G sudo your_username In the root terminal run visudo and locate the %sudo or %wheel references and make sure that the one that refers to the group you’ve added yourself to is uncommented, e.g. %sudo ALL=(ALL:ALL) ALL Log out of your desktop manager and log back in to activate the group membership you have just added yourself to. In a normal terminal, run sudo su – root and put your own password once asked. If all has gone to plan you should be presented with the root prompt. In another terminal, run gksu-properties and select sudo for Authentication mode and ensure Grab mode is set to enabled and press Close

Setting the order of multiple sound devices

In a terminal, run cat /proc/asound/modules to find out which sound modules are loaded. Say we get: 0 snd_emu10k1 1 snd_hda_intel 2 snd_usb_audio 3 snd_virmidi and say we want to rearrange them, so that: 0 will be the hda_intel, 1 will be the usb_audio, 2 will be the emu10k1 and 3 will be the virmidi Edit /etc/modprobe.d/alsa-base.conf and add to the end of the file the following line: options snd slots=snd_hda_intel,snd-emu10k1,snd-virmidi, Reboot the machine and the above order will be enforced In a terminal, if we now run cat /proc/asound/modules we get: 0 snd_hda_intel 1 snd_usb_audio 2 snd_emu10k1 3 snd_virmidi

JACK configuration for Real-Time Operation

Say our username is mike Run sudo usermod -a -G audio mike Edit /etc/security/limits.d/audio.conf and make sure it contains the following: @audio – rtprio 95 @audio – memlock unlimited Log out of your desktop and log back in. In a terminal, run ulimit -l to confirm the output is: unlimited

Change IP address after installation (Static IP)

Say on our host alpha we want to change (from DHCP) to a static IP Address 192.168.127.123 edit /etc/hosts and add an entry for alpha with 192.168.127.123 as: 192.168.127.123 alpha edit /etc/network/interfaces and make it look like this: auto lo iface lo inet loopback auto eth0 allow-hotplug eth0 comment the following line referring to DHCP #iface eth0 inet dhcp add the following for a static IP Address iface eth0 inet static change as necessary to an address /netmask from your network address 192.168.127.123 netmask 255.255.255.0 change as necessary to the gateway of your network gateway 192.168.127.1 change as necessary to match the DNS server of your network dns-nameservers 192.168.127.1 Lastly, in a terminal, run sudo service networking stop sudo service networking start