// Slackware 10.2 Tips // // by dual_parallel and bland_inquisitor // // http://www.dualisanoob.com Slack Tips for All ------------------ Writing a tips article is tricky. Especially for such a hallowed and "hardcore" distribution as Slackware. Veteran users want incredibly good tips. New users considering giving Slack a whirl, and who may be afraid of the BSD-style and command line mystique, want tips that bring accessibility and understanding to Slackware. Find that balance here. From simple bash techniques, to assuring your anonynimity on public Wi-Fi, this article will walk you through the Slackware tips most valuable to you. User Environment ---------------- Customizing your environment pays big dividends - aliased commands, custom paths, shortcut scripts - all can make your command line experience bliss. First, to customize your working environment, you need a good text editor. Vim is included with every major distribution, but we prefer the more accessible GNU nano [1]. Based on pico, nano can be compiled from source or downloaded as a Slackware package. One of the best aspects of nano is .nanorc [2], a resource file in your home directory where you can define default options and customize syntax highlighting. Nano and .nanorc make editing large config files almost a joy. Install nano and prepare to edit. Skip ahead to "Updates and Package Management" if you need assistance. You will be spending a lot of time with the default shell, bash, so this is where we'll begin. Create a file called .bash_profile in your home directory. You won't have to worry about login vs. interactive shells with this simple file. Edit .bash_profile and add these lines: -------------------------------------------------------------------------------- # .bash_profile # Source .bashrc if [ -f ~/.bashrc ]; then . ~/.bashrc fi -------------------------------------------------------------------------------- This sources, or executes, .bashrc, where many customizations will go. So on to .bashrc. Create .bashrc in your home directory. Edit the file and add all of those things you wish your shell would do. Here are a few examples. Keep the first export command in mind for later. -------------------------------------------------------------------------------- #.bashrc # Add bin to path export PATH="$PATH:$HOME/bin" # Dynamic resizing shopt -s checkwinsize # Custom prompt PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' # Add color eval `dircolors -b` # User defined aliases alias cls='clear' alias clls='clear; ls' alias ll='ls -l' alias lsa='ls -A' alias lsg='ls | grep' alias na='nano' alias web='links -g -download-dir ~/ www.google.com' -------------------------------------------------------------------------------- The shopt line makes bash evaluate how big the terminal is that you are working in after each command. That way, bash can resize your lines and columns depending on terminal size. The PS1 line adds a colorful prompt. The eval statement adds a little color to your actual terminal work. The aliases provide some keystroke-saving shortcuts. That is just a sampling of what fun can be had in .bashrc. Also, if you happen to be administering a Slackware box with many users, you can have them source the global /etc/bash/bashrc. Remember the export command? It changes the literal operating environment. The export command above added a ~/bin directory to the user's path. To see this, enter $ echo $PATH $ . .bashrc $ echo $PATH to manually source .bashrc and show the changes in your path. Having a subdirectory for executable scripts in your home directory is going to come in quite handy in a moment. Updates and Package Management ------------------------------ For updates and packages, LinuxPackages [3] is where you want to be. Does it offer the hours of soul-searching time that compiling from source can offer? No. But what installing .tgz files lacks in time consumption, it more than makes up for in ease and convienence. And for what it's worth, 10.1 packages work just fine in 10.2. A problem you may run into is that 10.1 packages are, by and large, a version old. If you are comfortable enough with the command line, you may be better served to compile from source. Regardless, here are the essential package management commands. To install a package: # installpkg To upgrade a package: # upgradepkg To remove a package: # removepkg It is worth this small caveat to mention that Slackware is a different distro for different people. Many seasoned Slack users have the initiative and know- how to keep up with Linux security to see when a specific package needs updating, rather than relying on a third-party repository to keep their boxen in line. With that said, if you like the ease of use and trust the repository, then slapt-get [4] is the command for you. Slapt-get repositories may be a little slow. The trade-off however of automated package management may outweigh speed, and even trust, especially for new users. To sync your package list: # slapt-get --update To upgrade packages: # slapt-get --upgrade To install a package: # slapt-get --install To remove a package: # slapt-get --remove The slapt-get FAQ [5] can help with more advanced situations, and here's a handy command that neatly lists all of your installed packages. # slapt-get --installed | sort | awk '{print $1}' | tee installed_packages Wireless Access and Anonymity ----------------------------- Oh, the can of worms you open when you go to the local cafe for some coffee and a little Wi-Fi. We are going to show some things that can help you stay anonymous at a public hotspot. You know what we hate? Having our MAC address broadcast for all the world to see. You don't need my MAC, nor does the owner of the hotspot need my MAC. The purple-haired guy with the 12" iBook definitely doesn't need my MAC, and we're going to take some serious steps to prevent it. 1. Make sure that no wireless interface comes up at boot. The way we are going to do this is to edit the file /etc/rc.d/rc.inet1.conf. For example, bland's network interfaces are set up so that eth0 is an Orinoco wireless adapter and eth1 is a 3Com NIC. Determine which interface is your wireless adapter with: # iwconfig Then you are going to, also as root, edit /etc/rc.d/rc.inet1.conf and remove the "yes" from the USE_DHCP line for your wireless device as shown here. USE_DHCP[0]="" This brings networking and the interface up at boot, but does not solicit the DHCP server at the hotspot, keeping your MAC your business. You may be asking, "If my interface does not get an address from the access point, then I cannot partake in the succint and prestigious Internet." That is true, more or less. We are going to obtain an IP from the DHCP server, just not yet. 2. Spoof your MAC address. The fact remains that you are going to need a MAC address for the DHCP server to assign an IP to. So you are going to use a MAC address, just not the one that came with your wireless card. There are many ways to spoof your MAC, but we will show one basic method. As root, type: # ifconfig eth0 hw ether 00:DE:AD:BE:EF:00 up # dhcpcd eth0 # ping -c2 google.com | grep received See where it says "2 received, 0% packet loss" down at the bottom? The tingling means that it's working. In just three lines, you... - Gave your wireless card a unique MAC address. - Performed a DHCP transaction with dhcpcd that bound an IP to your new, improved MAC. - Bounced two packets off of Google to assure ingress and egress from the router that was kind enough to let you on with such a bunk MAC. - Have taken a large step towards protecting your privacy. 3. Use your, possibly new, bash skills to automate such actions. Remember adding /root/bin/ to root's path? This is where it comes in handy. Copy those three lines above and paste them into a file called pubwifi in /root/bin. Add "#!/bin/bash" to the top and then chmod 700 /root/bin/pubwifi. Now when you go to your local haunt, you simply boot, su -, and type pubwifi. Similarly, you can make a /root/bin/homewifi that contains your home wireless settings, WEP and all. -------------------------------------------------------------------------------- #!/bin/bash /sbin/iwconfig eth0 essid SSID key INSERT_YOUR_WEPKEY /usr/bin/sleep 1 /sbin/dhcpcd eth0 /usr/bin/sleep 1 /bin/ping -c2 google.com | /usr/bin/grep received -------------------------------------------------------------------------------- Speaking of WEP, let us take this opportunity to address overall security. WEP may be acceptable security for you, or it may not. As a Linux user, you are more than likely conscious of security significant situations. Please use that awareness. A final wireless tip, which facilitates the awareness just mentioned, deals with Ethereal. Capturing packets with Ethereal is a prvileged operation. You may find that when you su - to run Ethereal on Slackware that you recive a display error. (ethereal:4148): Gtk-WARNING **: cannot open display: You could log out and then log back in as root, working around the problem. Or, you could just enter these commands, and then successfully launch Ethereal. $ xauth extract .xauth $DISPLAY $ su - # export DISPLAY=":0.0" # xauth merge ~username/.xauth # ethereal In Conclusion ------------- We were going to reiterate Slackware's simplicity, stability and security. Then we decided, "Why rehash facts that are constantly verified and validated?" So we won't. Instead, we say share any and all of your tips, and above all else, help others find GNU/Linux - Slackware or otherwise. Addendum -------- Here are a few tips that did not make the final edit. - Change the defualt runlevel to use a graphical login - XDM, KDM, etc. - in /etc/inittab by changing initdefault from 3 to 4. id:4:initdefault: - Edit /etc/inittab to create additional virtual consoles beyond tty6 in runlevel 4 by adding "4" to the runlevel fields. c1:12345:respawn:/sbin/agetty 38400 tty1 linux c2:12345:respawn:/sbin/agetty 38400 tty2 linux c3:12345:respawn:/sbin/agetty 38400 tty3 linux c4:12345:respawn:/sbin/agetty 38400 tty4 linux c5:12345:respawn:/sbin/agetty 38400 tty5 linux c6:12345:respawn:/sbin/agetty 38400 tty6 linux - Change the lilo timeout in /etc/lilo.conf to something feasible, say 10 seconds. Don't forget to run "lilo" after any configuration changes. timeout = 100 - Reduce laptop boot time by commenting out the probe line in /etc/rc.d/rc.pcmcia and uncommenting the appropriate module. # PCIC=probe # PCIC=i82365 # PCIC=tcic PCIC=yenta_socket Resources --------- [1] http://www.nano-editor.org/ [2] http://www.dualisanoob.com/dot/nanorc.txt [3] http://www.linuxpackages.net/ [4] http://www.linuxpackages.net/search_view.php?by=name&name=slapt-get&ver=10.2 [5] http://software.jaos.org/BUILD/slapt-get/FAQ.html Thanks to Dangerseeker and the readers of OSNews for the xauth tip for Ethereal! This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to: Creative Commons 543 Howard Street 5th Floor San Francisco, CA 94105 USA This work was written with GNU nano.