Difference between revisions of "Linux"
(→How To: firewalls) |
(→Firewalls: rescuing files) |
||
Line 88: | Line 88: | ||
iptables -L -v | iptables -L -v | ||
ipchains -L -v | ipchains -L -v | ||
+ | ===Rescuing Files=== | ||
+ | A quick and relatively-easy way to rescue files off a machine which won't boot from its hard drive is to boot from a Linux [[LiveCD]]. It is not even necessary to have a GUI (e.g. [[KDE]] or Gnome) running; the remote machine only needs network access and a [[ssh]] server. | ||
+ | |||
+ | The easy way - run this command on the local machine: | ||
+ | scp -vr <u>user</u>@<u>machine</u>:<u>sourcepath/mask</u> <u>targetpath</u> | ||
+ | |||
+ | Example: | ||
+ | scp -vr root@192.168.0.109:/mnt/hda2/* . | ||
+ | |||
+ | The disadvantage of this method is that the original timestamps (and other attributes) are lost; the files are written to the local disk with all timestamps set to now. | ||
+ | |||
+ | A method which preserves timestamps and attributes involves [[tar (command)|tar]]ring the files on the remote machine and piping the output of the tar over the network connection. ''These examples have not been used successfully; I am recording them for later testing. --[[User:Woozle|Woozle]] 07:04, 1 February 2006 (EST)'' | ||
+ | |||
+ | [[tar (command)|tar]] czpf - dir |[[ssh]] user@host 'cd /dir/path; tar xzpf | ||
+ | |||
+ | [[ssh]] ''user''@''machine'' 'cd /path; [[tar (command)|tar]] czvpf -' |tar xzf - | ||
+ | |||
+ | the "v" in "czvpf" is for "verbose", i.e. show the files as they are being tarred. | ||
+ | |||
+ | [[ssh]] root@192.168.0.109 '[[tar (command)|tar]] czvpC /mnt/hda2 -vf - *' |[[tar (command)|tar]] xzf - | ||
+ | [[ssh]] root@192.168.0.109 '[[cd]] /mnt; [[tar (command)|tar]] czvpf - hda2' |[[tar (command)|tar]] xzf - |
Revision as of 12:04, 1 February 2006
Computing: Operating Systems: Linux
Articles
- Linux Distributions: different versions of Linux
- Linux Shell Commands
- Linux vs. Windows
- Running a remote X session
Components
Desktop Environments
Device management
Security
- Linux users
- Linux groups
- Commands:
Hardware
- Linux Audio
- Linux Pro Audio: multitrack and high-rate/depth editing
- Linux Music Production: producing music using Linux
- Wireless Network Cards in Linux
- Optical Scanners in Linux
- Webcams in Linux
- Commands:
- Miscellaneous
- Chips
- WISChip GO7007(SB) (often used in TV tuner/capture cards): home page unofficial wiki
- Chips
Reference Links
- TuxMobil: Linux With Laptops, Notebooks, PDAs and Mobile Cell Phones
- Really Linux: for beginning Linux users
- LinuxQuestions wiki
- Linux Manpages: manpages documentation as searchable web pages
- Linux audio: guide to audio apps/systems in Linux
- Securing Linux
- Windows vs. Linux: comparative screenshots
- 2005-08-30 The State of Linux Graphics: technical backgrounder
Issues
The following may reflect my own ignorance rather than an actual shortcoming in Linux:
- Development
- There appears to be no mechanism corresponding to ActiveX (as used for desktop app development)
- There appears to be no application corresponding to Microsoft Access. Yes, you can do all the same stuff with various available tools, but not quickly; v2.0 of OpenOffice is apparently going to include a tool which may be a step in the right direction...
- Regular Use
- In Windows, if you create a link to an executable script (batch file -- *.bat) on your desktop (or anywhere), the link is executable with a double-click. Under KDE (in Ubuntu), I can't figure out how to make it execute at all without using a terminal. (Update: I have figured this out. Must document.)
Criticisms of UNIX, from which Linux is derived: 10 Things I Hate About UNIX
Things You Must Know
In Linux, you often run into things which you Just Have To Know in order to make things work; there is not really any way to find them out. This is bad UI design, but for now it's the situation. I will be listing them here as I find them out.
- When Perl is missing a module, the package name is always (I am told) "perl-libraryname". For example, for Tk.pm, the package is perl-Tk. So in Fedora you would type "yum install perl-Tk". Presumably in debian-derived distributions, you would type "apt-get install perl-Tk", though I have not actually tested this. (Remember that package names, like Linux filenames, are case-sensitive, so that T must be uppercase or it won't work.) If the library is within a Perl package, e.g. Net::Telnet, then the format is perl-Package-Library, e.g. perl-Net-Telnet.
- To run a binary which is located in the current directory, from the command line, you have to type "./" before the binary's name. It's not clear why this is.
- Linuxese for "help" is "man", which is short for "manual". This help system is often referred to as "the manpages".
How To
- To mount an ISO image as a folder:
mount -o loop NameOfISO.iso /mount/wherever On older distributions, you may need instead mount -o loop -t iso9660 ...
- To swap drives so DOS or Windows can be booted off the 2nd drive:
- On reboot, when you get to the boot loader startup, select whatever option gets you to a grub command line ("c" in Fedora Core)
- At the grub prompt, enter the following:
map (hd0) (hd1) map (hd1) (hd0) rootnoverify (hd1,0) chainloader +1 makeactive boot
This is a temporary fix which lets you test the changes without making your computer unbootable if they fail. To make the changes permanent, edit /boot/grub/menu.lst and enter the two "map" lines under the Windows entry. (Will document in more detail when I have time to look at the format of menu.lst. I'm also not sure if "hd" is always the prefix for the drives or if that might be different depending on the types of drives – e.g. SATA, ATA, IDE – involved.)
- Time Zone: If the KDE Clock-setting widget seems to be refusing to set the time zone (or your system clock is refusing to show anything except GMT time), this command may work:
ln -s /usr/share/zoneinfo/America/NewYork /etc/localtime
...where "/America/NewYork" should be replaced by the appropriate file for your time zone. I have not been able to find any documentation on this feature; the command was suggested to me by someone in the #kde chat room at irc.freenode.net (see [1]). Remember to use the console "date" command to verify what the system clock is currently set to. --Woozle 08:45, 23 Apr 2005 (CST)
- To force an update of the system clock:
ntpdate pool.ntp.org
- To make this update run automatically, go into root and run kcron (or cron if you're comfortable with CLI
- Emptying the Trash: KDE does have trash-management built in, but it's not always obvious. You can do any of the following:
- Navigate (in Konqueror) to "trash:/", then right-click on the panel showing the contents, and select "Empty trash".
- Right-click on the applet panel and add the Trash applet, then left-click on it to use its various functions.
- Create a new URL link on the desktop, give it the URL "trash:/", then right-click on it (my preferred solution). A trashcan icon is available in the "filesystems" icon group.
Firewalls
Some Linux distributions come with a GUI-based firewall management tool, but these generally are just wrappers around a set of text commands. Apparently, a firewall can be set up using either iptables or ipchains; to query both commands for firewall rules:
iptables -L -v ipchains -L -v
Rescuing Files
A quick and relatively-easy way to rescue files off a machine which won't boot from its hard drive is to boot from a Linux LiveCD. It is not even necessary to have a GUI (e.g. KDE or Gnome) running; the remote machine only needs network access and a ssh server.
The easy way - run this command on the local machine:
scp -vr user@machine:sourcepath/mask targetpath
Example:
scp -vr root@192.168.0.109:/mnt/hda2/* .
The disadvantage of this method is that the original timestamps (and other attributes) are lost; the files are written to the local disk with all timestamps set to now.
A method which preserves timestamps and attributes involves tarring the files on the remote machine and piping the output of the tar over the network connection. These examples have not been used successfully; I am recording them for later testing. --Woozle 07:04, 1 February 2006 (EST)
tar czpf - dir |ssh user@host 'cd /dir/path; tar xzpf
ssh user@machine 'cd /path; tar czvpf -' |tar xzf -
the "v" in "czvpf" is for "verbose", i.e. show the files as they are being tarred.
ssh root@192.168.0.109 'tar czvpC /mnt/hda2 -vf - *' |tar xzf - ssh root@192.168.0.109 'cd /mnt; tar czvpf - hda2' |tar xzf -