LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 09-24-2005, 01:22 PM   #1
Unduhtakuh
LQ Newbie
 
Registered: Jan 2005
Posts: 10

Rep: Reputation: 0
Slackware 10.2 Tips


Code:
// 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/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 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_...t-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.

Last edited by Unduhtakuh; 09-25-2005 at 01:09 PM.
 
Old 09-24-2005, 05:43 PM   #2
Charred
Member
 
Registered: Mar 2005
Location: Utah, USA
Distribution: Slackware 11
Posts: 816
Blog Entries: 2

Rep: Reputation: 30
Thanks for the tips!
Aaand off the zero-replies list we go...
 
Old 09-24-2005, 06:01 PM   #3
Namaseit
Member
 
Registered: Dec 2003
Distribution: Slackware
Posts: 325

Rep: Reputation: 30
Some good tips but there is one that creates a horrible security situation.

Where it tells you how to run ethereal as a privileged user and have the display show
up on a lower privileged users screen by executing the line "xhost +" by doing that you are
telling X that there is *NO* authorized access list and lets *ALL* connections to the X server.
You can see how this creates a bad situation. The better method would be to specify 1 host that can connect.
So you would instead do "xhost +127.0.0.1" and only allow connections coming from localhost. Or even "xhost +192.168.0.19"
If you wanted something from a remote server/client to display on your X session. Just don't do "xhost +". It's a bad idea and
a bad suggestion.
 
Old 09-25-2005, 01:08 PM   #4
Unduhtakuh
LQ Newbie
 
Registered: Jan 2005
Posts: 10

Original Poster
Rep: Reputation: 0
Looks like they fixed the article...

http://www.osnews.com/comment.php?news_id=11979

...so I went ahead and fixed it here.
 
Old 09-25-2005, 03:22 PM   #5
jonnybot
LQ Newbie
 
Registered: Sep 2005
Distribution: Mandrake & Puppy
Posts: 8

Rep: Reputation: 0
Creating the .bash_profile file helped a lot, even though I used vim to do it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tips lukepiewalker Linux - Newbie 4 08-03-2005 06:18 AM
Slackware 10 + Nforce2 Onboard LAN Tips orgee Slackware 6 01-12-2005 12:50 AM
Slackware tips and tricks monkeymartin Slackware 3 11-12-2003 04:17 AM
Some Slackware tips tangle Slackware 3 08-02-2003 12:17 PM
Slackware Tips Artimus Slackware 2 02-28-2003 06:21 PM


All times are GMT -5. The time now is 12:15 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration