Welcome to Server Circle. It's a friendly site and all levels of experience are welcome. Be aware that we use cookies for your login.
Server Circle - Ask questions about Servers and get answers from experts.
Beta (0.92 sec)
s's profile (3383 points)

About:
Can I just have UDP and not ICMP or TCP?
Asked in: Linux-Servers  (4 answers)
s's response:
tcpdump -i eth0 udp
I don't want to install X windows on my server but want to be able to use browser functionality. Can this be done and can I install just a few packages so that I don't add security holes with lots of extra packages ?
Asked in: Ubuntu-Linux-Servers  (4 answers)
s's response: There exist a number of non-X browsers that you can use in a terminal: elinks, w3m, links, lynx. Perfect to read local HTML documentation or test local web server. There are a number of lightweight X browsers (midori, dillo) as well. Then, you can always port forward ports to your workstation with ssh so that you can use your workstation's browser (remember you can type ~C in a ssh session to add more port forwardings and see also the -D ssh option for SOCKS support (most browsers support SOCKS or can be used with a socks wrapper (tsocks, dante...)).
I know we can monitor if a port is open remotely but what about an application ? I need to receive alerts if one fails. Thank you.
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: You could used snmpd's process check. See
man snmpd.conf | less +/'Process Monitoring'
My old server only has console access and no VGA. Can I install Ubuntu Server over console only in text mode ?
Asked in: Ubuntu-Linux-Servers  (4 answers)
s's response: I would put the disk in another machine and install it from there. Or boot a live CD with a ssh server, export the disk and install with deboostrap or as a VM on the exported disk (for instance via nbd).
One of my servers all but lock up when I run find like this: find / -name filename Any ideas how to prevent it ? Thanks a lot for your help.
Asked in: Linux-Servers  (4 answers)
s's response: Use the -xdev option. find is probably trying to go into network or automount or special file systems. Have you considered using locate/mlocate/updatedb?
How can I stop my DHCP logs in /var/log filling up my disk ? I'm not sure if it can be done.
Asked in: Linux-Servers  (4 answers)
s's response: Which dhcp server implementation? Which syslog implementation? Have you checked your dhcp server and/or syslog documentation?
Can I redirect traffic to port 110 to port 143 for example ? I need to move IP addresses round and ideally not ports too.
Asked in: Email-Servers  (3 answers)
s's response:
socat tcp-listen:110,fork,reuseaddr tcp:some-host:143
Would redirect incoming connections to port 110 to some-host:143.
Is it possible to get a flawless VM built out of using a conversion tool, directly from a physical server ? I have three servers I'd like to backup as complete VMs - complete being the magic word and I don't want lots of extra fiddling.
Asked in: Virtual-Machines-Servers  (3 answers)
s's response: VMs are machines with a virtual hardware. At the very least, you can do the same thing as you would do with real machines. You can use the same method as you would to clone real servers.
I know there's two manully made mistakes in /etc/shadow. Can I restore them on the system without spending ages looking through backups ? Thanks very much. I'm using Ubuntu Server BTW.
Asked in: Ubuntu-Linux-Servers  (4 answers)
s's response: From /etc/shadow-?
Which file in kernel illustrates the CPU scheduling algorithm?
Asked in: Linux-Servers  (3 answers)
s's response: kernel/sched* though you may want to start with Documentation/scheduler/ or various articles at lwn.net or a good book on Linux kernel internals.
Can I switch off the yes/no question in SCP when I connect to a new server ?
Asked in: Linux-Servers  (3 answers)
s's response: scp -o 'StrictHostKeyChecking no' ... Or you can add that option to your ~/.ssh/config Beware that it has security implications. See the ssh_config(5) man page for details.
Please say step by step. How I can install and configure kernel 3.0 ?
Asked in: Linux-Servers  (5 answers)
s's response: If your distribution already has it packaged: install the package If not, see if it's available in an alternative package repository (for debian, look in "unstable"/"sid"). If not, I would advise against installing it yourself until you learn by yourself what it entails (and in that process, you'll learn how to do it). Note that version 3.0 is the continuation of 2.6.39, there's less difference between 2.6.39 an 3.0 than between 2.6.38 and 2.6.39, so I would wait until your distribution packages it.
I've been manually creating index.html files in each of my subdirectories but how do I ban directory listing for the entire Apache server ? Should I do both do you think ? Thanks you.
Asked in: Linux-Servers  (3 answers)
s's response: If your web server is apache, just disable the Indexes option
        <Directory /var/www/your-directory>
                Options -Indexes
        </Directory>
Beware of .htaccess files that may re-enable them.
I have around twenty remote servers that I frequently need to upload a new XML to and then restart a daemon afterwards. The basic commands are: scp SourceFile user@host:directory/TargetFile I can do /etc/init.d/daemon restart How would I wrap them into a script which would do each server one by one ? Would I need another file with IP addresses of the servers to reference ? A hundred points to you for a script that works and the best answer points too. Thanks.
Asked in: ShellScripts  (4 answers)
s's response: Write the script that does this:
#! /bin/sh -
user=$1; shift
for server do
  ssh "$user@$server" < Sourcefile '
     cat > directory/TargetFile && /etc/init.d/daemon restart'
done
And then you can pass the list of servers as you like such as xargs < servers.txt your-script root
How can I be sure that my Postfix mail server isn't't configured to be an open relay? Thanks.
Asked in: Email-Servers  (1 answers)
s's response: Identify what port postfix is listening on (sudo netstat -anp | grep -e LISTEN or sudo lsof -nPi tcp | grep LISTEN. Those bound to 127.0.0.1 or [::1] shouldn't be a concert unless you have REDIRECT firewall rules. Then figure out which of those ports are exposed to the internet and how. Then from an IP address your server is not meant to relay for:
telnet your-server the-port
EHLO localhost
mail from: your-address
rcpt to: foo.bar@gmail.com
If that RCPT TO is accepted, then you've got an open relay. For SSL ports, use openssl s_client -connect your-server:port or socat readline openssl:mail.seebyte.com:465,verify=0. Do that for every port, also mind for possible NAT routers or SOCKS proxies that might be misconfigured and allow connection to your mail server and masquerade the source IP address of incoming connections to one of your internal IPs from where relay is allowed.
How do I generate an strace report for a developer ? I'm using Ubuntu Server 10.04 Lucid Lynx. Thank you.
Asked in: Ubuntu-Linux-Servers  (4 answers)
s's response:
strace -vfTtto strace.log cmd args
Or for an already running command. strace -vfTtto strace.log -p pid
Control-C and other Control keystrokes don't get me out of a telnet session properly. How do I do it ? Thank you for your help.
Asked in: Server-Networking  (5 answers)
s's response: <Ctrl-]>, then enter quit
I have a SSL site working now but the certificate runs out soon. I purchased a renewed certificate and installed it like I have done a thousand times before but it doesn't work. When I reload the web server it just fails no errors in stdout or in the logs. I put the old certs back in and everything works fine. Now my cert provider has upgraded to 2048 encryption so I had to regenerate my private key before I could use the new cert. Yes I am pointing to the new key and the new cert in my conf file. If I could get an error that would be great then I could figure it out but I'm getting anything. This is a production system so down time is unacceptable but I need to update this cert. Any body know how I can troubleshoot this? Ubuntu 10.04 server x86_64 Apache 2.2.14
Asked in: Linux-Servers  (2 answers)
s's response: The private key is tied to the certificate, you can't just create a new private key to work with an already existing certificate. You'd create a key pair, then use it to generate a certificate request, then have that signed by your certificate authority. Then you'd use the certificate they give you back with the key you generated. As Trinity says, that certificate may be signed by a root authority of an intermediate authority in which case, you'll have to configure apache to send that (and possibly more in the chain) to clients as well so that they can link your certificate to the root certificate authority they trust (SSLCACertificateFile configuration parameter). To get more information from apache, try and increase the log level:
LogLevel debug
What's usage of yes command and /dev/full ? I would be appreciate it if you explain them with an example.
Asked in: Linux-Servers  (3 answers)
s's response: /dev/full is not a command, so you can't do /dev/full > filename /dev/full simulates a file on a full file system, that is writing to it would return a ENOSPC error ("no space left on device") You can get information on device files on Linux in the Linux kernel sources in Documentation/devices.txt
$ grep /dev/full Documentation/devices.txt
                  7 = /dev/full         Returns ENOSPC on write
yes is a command that outputs "y\n" continuously, so as Jalal said is typically used to feed to a command to anser "yes" automatically. Most implementations of "yes" can take arguments that are then output instead of "y". yes n would be the no command.
Out of curiousity what do the values in these files mean ? I see tw in /proc/net/sockstat for example and frag. Any experts willing to help ?
Asked in: Linux-Servers  (3 answers)
s's response: jalal, you could have said that those were wild guesses. As it happens, it's wrong. The tw parameters gives the current number of TCP sockets in the TIME_WAIT state. See http://books.google.com/books?id=ptSC4LpwGA0C&pg=PA43 for details on what the TIME_WAIT state is. The FRAG statistics give a number of structures associated with IP fragmentation currently in use. From reading the kernel source, those are queues allocated to keep track of fragmented IP packets waiting to be reassembled. inuse would give the number of those (so I suspect the number of packets waiting to be fully reassembled) and mem, the kernel memory they occupy. IP fragmentation occurs on a IP host (the sender or any router on the path) when the MTU of the next link where that packet is to be forwarded to is smaller than the size of the packet (and the DONT_FRAGMENT flag is not set on the packet, other it returns an ICMP message saying it can't send as with TCP).
I have a box that dies (seemingly when it's busy) every now and again and needs rebooted to bring back up. It's not fun. The software has rarely changed and I can't find anything in the logs. It's only about a year old and can't be dusty or anything like that. Any bright ideas ? Thanks very much.
Asked in: Suse-Linux-Servers  (5 answers)
s's response: Nothing on the console when it locks up? Does the sysrq key combination work when it's locked up? (on a VGA console (h for help), on a serial console, h)
Out of curiousity what do the values in these files mean ? I see tw in /proc/net/sockstat for example and frag. Any experts willing to help ?
Asked in: Linux-Servers  (3 answers)
s's response: tw is TCP TIME_WAIT. You'll get the same number as returned by netstat -an | grep -c TIME_WAIT. FRAG is for IP fragmentation, not sure what the values mean though.
Does anybody know a good (if possible opensource) disk usage reporting tool that would report disk usage in a graphical fashion. Something along the lines of xdu, baobab or kdirstat, but as HTML. The closest to what I need that I've found so far is durep. Unfortunately, the performance is not good enough for my purpose (takes over 24 hours to generate the database). gt5 is not workable either as the report is one huge HTML file. Ideally, it could take as input the output of "du -ak".
Asked in: Linux-Servers  (5 answers)
s's response: Well, torta will only display directory components that are represented by a sector of an angle below 2 degrees, so by filtering the output of du to only include entries with a size >= totalsize*2/360, it can cope with any directory size. It won't give anywhere near as much information as kdirstat, but it's still good to quickly spot abnormalities in disk usage, and it's quite efficient. So for now, I use that plus a sorted du -a --time output.
I have a box that dies (seemingly when it's busy) every now and again and needs rebooted to bring back up. It's not fun. The software has rarely changed and I can't find anything in the logs. It's only about a year old and can't be dusty or anything like that. Any bright ideas ? Thanks very much.
Asked in: Suse-Linux-Servers  (5 answers)
s's response: I would start with making sure the console goes to a serial port (add console=ttyS0,115200n8 console=tty0 to the kernel parameters in your boot loader configuration, optionally also add a getty on that serial port in /etc/inittab or equivalent on your distribution). Connect that to another server and connect a GNU screen window to that (in screen :screen /dev/ttyS0 115200,cs8), log that window (H). Also make sure none of the sysrq keys are disabled:
echo kernel.sysrq=511 > /etc/sysctl.d/sysrq.conf
That way, you'll have a chance to see kernel panics or oopses if any and run sysrq-t and the like to get a chance to see where it's stuck. Look for firmware upgrades for BIOS, network adapters, disk controllers... on your server.
I need to change any occurrences of RTG78 in several files at once ? Thanks !
Asked in: ShellScripts  (4 answers)
s's response: With GNU utilities:
find . -type f -exec grep -lZ RTG78 {} + | xargs -r0 sed -i 's/RTG78/something/g'
If there may be binary files, you may want to use perl instead of sed:
find . -type f -exec grep -alZ RTG78 {} + | xargs -r0 perl -pi -e 's/RTG78/something/g'
(or use perl in anycase)
Can someone give me a little bit of help please ? I'd like to backup a directory on a server over SSH using rsync. I get a bit lost with simple bash scripts though. So far I have this: #!/bin/bash cd backup_directory time rsync -e 'ssh -c blowfish -oPort=2222 -ax' -avzx --stats --progress user@server:/var/DIR . Does that look like a sensible approach to syncing a folder ? Thanks for any pointers.
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: Your could use arcfour instead of blowfish for a less expensive cipher. With -z, you may want to adjust the --compress-level as well to limit the CPU utilisation as well. Also note that -a doesn't preserve everything. I'd use --numeric-ids to avoid surprises when doing the restore, --sparse to save space, especially if there are sparse files on the sending side. To sum up:
rsync -e 'ssh -c blowfish -o BatchMode=yes -o StrictHostKeyChecking=yes -o 

ServerAliveInterval=10 -p 2222 -ax' 
  --archive --xattrs --hard-links --numeric-ids --sparse --acls  --compress-level=3
How do I write the system clock time to the hardware clock ? I'd like to be able to do it manually and also enforce it at reboot time. Thanks for your help.
Asked in: Linux-Servers  (3 answers)
s's response: With the clock or hwclock command.
Sometimes dmesg gets full of junk and I want to add something to the end. I know logger works with syslog but what about writing to dmesg so the last few entries are no longer junk ? Thanks in advance for any help.
Asked in: ShellScripts  (5 answers)
s's response: Actually, the interface does exist:
echo test > /dev/kmsg
I have a new way of logging Apache hits in tandem with existing logs that will grow far more rapidly than those already set up. Can I just copy logrotate files for other daemons ? Do I have to start and stop anything ? Thanks.
Asked in: Linux-Servers  (3 answers)
s's response: Yes, you can copy and edit/adapt conf files. Those conf files are only read when logrotate is started by a cronjob at night. You don't need to restart anything.
Our primary HD is crashing and turning the ext3 system into read_only mode, I guess its due to high i/o usage because of about 8k simultaneous users on high traffic hours. Can anyone tell me how to detect high I/O and from what process it's coming from? (apache, php, email, etc). Also, any tips to reduce I/O usage? I'm using a 500 GB SATA HD. Thanks a lot!
Asked in: Linux-Servers  (9 answers)
s's response: What error message did you get? Have you checked the SMART status of the disk (smarctl -a /dev/sda)?
Does anybody know a good (if possible opensource) disk usage reporting tool that would report disk usage in a graphical fashion. Something along the lines of xdu, baobab or kdirstat, but as HTML. The closest to what I need that I've found so far is durep. Unfortunately, the performance is not good enough for my purpose (takes over 24 hours to generate the database). gt5 is not workable either as the report is one huge HTML file. Ideally, it could take as input the output of "du -ak".
Asked in: Linux-Servers  (5 answers)
s's response: torta is good, it can even take "du -ak" output and the filelight-like representation is nice. Unfortunately, it doesn't scale to large directories either...
My netcat (nc) doesn't listen! It means when I write nc -l 3333, I can't communicate data with nc 127.0.0.1 3333 in another terminal! Also after writing nc -l 333, I don't see port 333 between the ports which are listening, by netstat -ln | grep 3333. What should I do? Thank you!
Asked in: Linux-Servers  (9 answers)
s's response: Running the programs that don't seem to behave as expected with
strace -fe network your program and its arguments here
Might help. Is your loopback interface configured (ifconfig lo)? To you have any firewall setup (iptables-save)?
I need to check information on xt_state and xt_limit but can't find their man pages. Any ideas ?
Asked in: Server-Firewalls  (2 answers)
s's response: xt_state and xt_limit are the names of the modules. User documentation is in the iptables(8) man page for "state" and "limit" in the "MATCH EXTENSIONS" section.
I need to send a username and password over a URL. How does this work ? I can't seem to find anyway that has help.
Asked in: ShellScripts  (2 answers)
s's response: Your question is unclear. Please rephrase. http://server:port/path/to/file?username=foo&password=bar#fragment is an URL that says establish an HTTP connection to "server" on port "port" and do a GET request of /path/to/file?username=foo&password=bar which is generally understood by querying a command (identified by its "/path/to/file" path) and pass it two parameters "username" with value "foo" and password with value "bar". Once the content of that page is retrieved, the browser is to find a "fragment" fragment in there and jump there.
I'm looking for a comprehensive list of what Ethtool means when it reports certain things: rx_csum_offload_good: 359399 rx_csum_offload_errors: 19 The offload errors are of interest at the moment but I've had to spend ages hunting for other errors in the past too. Anyone have a good list of codes and meanings please ?
Asked in: Linux-Servers  (2 answers)
s's response: Many of the ethtool statistics are driver specific. So, you'll generally get the information from the driver itself, its documentation or the documentation of the device it's meant to drive. rx_csum_offload_good is probably from the e1000 driver (see ethtool -i to know which driver you're using). Then look at the driver source. For e1000, you'll find that rx_csum_offload_errors is incremented when the device reports E1000_RXD_ERR_TCPE in the status flag of a received frame. Then you could dig the Intel specifications to see what it means but my guess would be that the TCP checksum didn't match for one TCP packet (TCP checksum offloading means to let the NIC do the checksum verification).
Does anybody know a good (if possible opensource) disk usage reporting tool that would report disk usage in a graphical fashion. Something along the lines of xdu, baobab or kdirstat, but as HTML. The closest to what I need that I've found so far is durep. Unfortunately, the performance is not good enough for my purpose (takes over 24 hours to generate the database). gt5 is not workable either as the report is one huge HTML file. Ideally, it could take as input the output of "du -ak".
Asked in: Linux-Servers  (5 answers)
s's response: Sorry, maybe I wasn't clear. I need something that shows disk usage graphically per directory in a fashion that helps identify where the disk is being used up. The old-timers will be familiar with xdu that shows rectangles for each file or directory whose size is proportional to their size. Newer applications like filelight or kdirstat have even fancier representations. I've found pydirstat, but unfortunately, it doesn't scale to big file systems. I've fount "torta", but haven't managed to make it work yet.
I'm trying out Gentoo and just got this error, I'm glad it's not a critical server ! What could be causing this kernel problem at boot time ? VFS: Cannot open root device "sda1" or unknown-block(1,0) Please append a correct "root=" option Kernel panic - not syncing VFS: Unable to mount fs on unknown-block(1,0) Thanks very much.
Asked in: Gentoo-Linux-Servers  (3 answers)
s's response: Possibly /dev/sda has been assigned to something else like some USB stick... That's why it's generally a good idea to use uuids or labels or LVM to identify the root filesystem. The message suggests it is the kernel that tries to mount the root filesystem, not an initrd. I'm not familiar with gentoo, but are you sure it's meant to boot without an initrd? The initrd would generally care to load the modules necessary to access and mount the root filesystem (and possibly do some more initialisation). If not using an initrd, the kernel has to have all the drivers for the disk and filesystem holding the root filesystem built in. Is that the case? What boot loader are you using, what's its configuration? If grub, you should be able to get to its command line and get more information from your system.
My netcat (nc) doesn't listen! It means when I write nc -l 3333, I can't communicate data with nc 127.0.0.1 3333 in another terminal! Also after writing nc -l 333, I don't see port 333 between the ports which are listening, by netstat -ln | grep 3333. What should I do? Thank you!
Asked in: Linux-Servers  (9 answers)
s's response: port 333 is under 1024 so priviledged. You should have seen an error message when running nc -l 333. Anyway, "nc" is a crap software with many different implementations trying to fix many of the bugs of the original version (which was admittedly created by a student to learn about network programming). You could consider socat instead: socat tcp-listen:3333,reuseaddr - would probably be the equivalent of nc -l 3333 And socat - tcp:127.1:3333 the equivalent of nc localhost 3333
Our primary HD is crashing and turning the ext3 system into read_only mode, I guess its due to high i/o usage because of about 8k simultaneous users on high traffic hours. Can anyone tell me how to detect high I/O and from what process it's coming from? (apache, php, email, etc). Also, any tips to reduce I/O usage? I'm using a 500 GB SATA HD. Thanks a lot!
Asked in: Linux-Servers  (9 answers)
s's response: You can watch IO stats per disk with iostat or dstat (or /proc/diskstats) Per process with iotop See lsof and strace to find out what is being written where. Adding more RAM would probably reduce disk usage by caching more in memory. Try and identify what is doing I/O.
I'm using this command at the moment: find . -size +500000 -print but it isn't very refined. How else can I track down large files on my filesystem ?
Asked in: ShellScripts  (4 answers)
s's response:
find . -printf '%s\t%p\n' | sort -rn | head -30
Will give the 30 largest files, it won't necessarily report the ones that take up the most space on disk though. Use %k instead of %s for disk usage (in kb) instead of file size. That assumes GNU find as -printf is GNU specific. With zsh:
ls -ldU -- **/*(DOL[1,30])
Sometimes dmesg gets full of junk and I want to add something to the end. I know logger works with syslog but what about writing to dmesg so the last few entries are no longer junk ? Thanks in advance for any help.
Asked in: ShellScripts  (5 answers)
s's response: You could use this trick: mount -o 'remount, some comment here ' / (yes there's a newline after "," and before "'") Then, you'll get [193337.614978] EXT4-fs (dm-0): Unrecognized mount option " [193337.614980] some comment here [193337.614981] " or missing value
I need to delete all files that end .gif and somewhere in the name have "RFJ". There are hundreds of other files and some also have RFJ in their name. There's loads of subdirectories too. I can't risk deleting live image files because it's a web server and a restore from the backups will take time. Any help would save me a heap of trouble !
Asked in: ShellScripts  (4 answers)
s's response: With GNU find: find /path -name '*RFJ*.gif' -delete
Can I just download a patch then apply it to package file and then run apt-get install to install it ? How does it work ? Thanks.
Asked in: Linux-Servers  (3 answers)
s's response: You'd do: apt-get source the-package Add the patch to debian/patches, update debian/patches/series Run dch to give a new version number to your package build using dpkg-buildpackage Then, you'd obtain a .deb which you can install with dpkg
I'm seeing this error in my mail client when I'm trying to connect to our mail server. What could it be ?
Asked in: Email-Servers  (2 answers)
s's response: An indication that the SMTP server it is talking to is not supporting SMTP extensions. It's probably more a warning than an error as your client should still be able to send the email. That your mail server is not supporting EHLO is quite worrying though.
I need to view a remote console over HTTP with javascript enabled. Is it possible ? Thanks.
Asked in: Linux-Servers  (1 answers)
s's response: elinks has some level of support for javascript (using firefox engine) but you may have to compile it yourself as versions shipped with some distributions don't have it enabled.
Can I be sure when I delete a file on my Ubuntu server that no-one will be able to read it from my drive ? Are there any ways to be REALLY sure ?
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: Removing the files gives no guarantee at all. Take all the hard drives out and drop them in sulfuric acid after having given them a good beating with a sledgehammer. Alternativery, you could try using "wipe" (and see the comments in the man page), on the file and all the swap partitions (after having done a swapoff -a). That may not be enough if using file systems like btrfs or LVM snapshots or the file has been copied from some other file...
Can I backup the master boot record before I mess around with fdisk ? Any warnings I should watch out for ?
Asked in: Linux-Servers  (2 answers)
s's response: dd count=1 < /dev/sda > sda.mbr to restore: cp sda.mbr /dev/sda
I just saw this post about WUBI and found it interesting: http://www.servercircle.com/Linux-Servers/Can-you-use-WUBI-on-Ubuntu-Server-?_1313 How do I resize a loop disk if I need to have more data on it ? Is it possible to do this ? I would keep it quite small for backups obviously. Does anyone use loop disks like this already ?
Asked in: Linux-Servers  (1 answers)
s's response: If we're talking of loopback devices, use losetup -c: $ truncate -s10G ~/a $ sudo losetup /dev/loop0 ~/a $ sudo blockdev --getsize /dev/loop0 20971520 $ truncate -s 20G ~/a $ sudo blockdev --getsize /dev/loop0 20971520 $ sudo losetup -c /dev/loop0 $ sudo blockdev --getsize /dev/loop0 41943040 Then you can repartition and/or resize the filesystem (not all file systems can be resized while mounted, note).
I know it's not really for servers but the loop disk idea looks pretty clever and you can copy a live install really easily. What do you think ? Please see last question about disk images: http://www.servercircle.com/Linux-Servers/Saving-a-whole-drive-to-an-image-file-without-dd-and-rsync_1311
Asked in: Linux-Servers  (1 answers)
s's response: Copying a regular file mounted via a loop device or copying a block device doesn't make any difference. No advantage wrt your "saving a whole drive" query. And you're going to lose in performance and it's not space efficient as would be other looping solutions like qemu-nbd (which supports snapshotting). Again, the way to go to have consistent filesystem backup is LVM or btrfs or ddsnap or zfs (all those solutions that provide with a snapshotting facility).
Is there a simple tool to backup a whole partition or drive of a server ? The server must still be running. I don't want to fiddle with dangerous dd or rsync commands but can use a command line rather than a GUI if needed. I need it to be simple so I don't write over a live server drive ! It's important the backup and restore can be done without a reboot. Thank you.
Asked in: Linux-Servers  (2 answers)
s's response: Your question doesn't make sense. You can't do a consistent image of a block device if something is writing to it. You can't change the content of (restore) a block device under the system or application feet without causing havoc. What you can do if using LVM is make a snapshot of a volume and then copy it elsewhere. That can be done live. But for restoring, that can't be done live. If the system is virtual and the file system used is xfs. You can do xfs_freeze on the guest and then take a snapshot of the virtual disk on the host to have the disk and the filesystems on it on a consistent state (you may also want to tell some applications like RDMs to make sure their files on disk are in a consistent state). But again, you can't restore live the disk. You can also work at file level using rsync or tar/pax/cpio... on the snapshots. You can restore live (with rsync), but that may still cause havoc if restoring files under applications feet. That can be limited if you stop those applications (think for instance RDBMs) before doing the snapshot and before doing the restore.
I need to flag a warning if a text file, with loads of information in it, has IP address duplicates in it and roughly where in the script they occur. The IPs are all in the format 100.100.100.100. Could I use uniq and sort ? Any takes ? I'll happily pass on fifty of my points and the best answer points.
Asked in: ShellScripts  (2 answers)
s's response: You could use uniq and sort like in: grep -Eo '([0-9]+.){3}[0-9]+' < /etc/hosts | sort | uniq -c | awk '$1>1' | sort -rn But that wouldn't tell you where they are. This should: http://pastie.org/2134767
I'm trying to use "Volume Shadow Copy" on Windows XP to export a shadow copy of a Windows volume over Network Block Device. For that, I'm using vshadow from Microsoft VSS toolkit. That takes a snapshot, and I can use nbd-server (from nbd.sourceforge compiled on cygwin) to export the volume snapshot over nbd. That is working great except that I realised that the snapshots are actually not snapshots: they do change over time: I did two ntfsclone of the same nbd device from the same shadow copy and they do differ. On the one instance I'm investigating on none of the file contents in the two clones differ. Even the \pagefile.sys files are the same. Though on a 8GiB volume, there were about 3MiB of differing bytes. From wikipedia, vss is meant to work at block level, so I don't understand why there would be any difference there. Any idea what I could be doing wrong, what's happening, how to avoid it?
Asked in: WindowsServers  (4 answers)
s's response: Thanks. http://http//www.sbs-rocks.com/Windows%20Server%20Hacks%20Excerpt.htm has very useful information and helped me get on the right track. I found the ntfscluster command that gives the path of the file(s) using a given cluster or cluster range. It appeared that all the clusters that were differing were from a /System Volume Information/1{some-uuid} file. (I don't know what the some-uuid is refering to). That file has a size of 0 but an allocated size of 100MB. Dumping attribute $DATA (0x80) from mft record 52569 (0xcd59) Resident: No Attribute flags: 0x0000 Attribute instance: 1 (0x1) Compression unit: 0 (0x0) Data size: 0 (0x0) Allocated size: 104857600 (0x6400000) Initialized size: 0 (0x0) That is why I couldn't see any difference when comparing files inside the FS. Still ntfsclone does copy those 100MB as they are allocated. The work around I found was to run nbd-server in cow mode, to be able to mount the nbd device in read-write. Then, I could delete that file and ntfsclone wouldn't clone it then. I think it is OK to do so as the clusters I mean to copy are meant to be left untouched so any cluster that is modified during the clone behind my feet won't be referenced by any file or directory in the snapshot. The tests I did were all successful.
I'm looking at doing some basic IDS stuff with IPtables from: http://netfilter.org Can someone point me at some useful examples please for matching packets with a string ? Cheers.
Asked in: Server-Firewalls  (3 answers)
s's response: Sorry, it should read -I instead of -D, I had copy-pasted the wrong command. Use -D to remove the rule after.
I'm looking at doing some basic IDS stuff with IPtables from: http://netfilter.org Can someone point me at some useful examples please for matching packets with a string ? Cheers.
Asked in: Server-Firewalls  (3 answers)
s's response: sudo iptables -D INPUT -m string --string servercircle -j LOG --algo bm --log-prefix SERVERCIRCLE You'd think that'd log your browsing to servercircle. Not if compression is enabled (see Content-Encoding: gzip in the HTTP headers).
I'm trying to use "Volume Shadow Copy" on Windows XP to export a shadow copy of a Windows volume over Network Block Device. For that, I'm using vshadow from Microsoft VSS toolkit. That takes a snapshot, and I can use nbd-server (from nbd.sourceforge compiled on cygwin) to export the volume snapshot over nbd. That is working great except that I realised that the snapshots are actually not snapshots: they do change over time: I did two ntfsclone of the same nbd device from the same shadow copy and they do differ. On the one instance I'm investigating on none of the file contents in the two clones differ. Even the \pagefile.sys files are the same. Though on a 8GiB volume, there were about 3MiB of differing bytes. From wikipedia, vss is meant to work at block level, so I don't understand why there would be any difference there. Any idea what I could be doing wrong, what's happening, how to avoid it?
Asked in: WindowsServers  (4 answers)
s's response: The 3MB of difference were when comparing the two clones of the raw volumes. ntfsclone works by copying only the allocated clusters in a NTFS volume. Which is why I'm surprised that when comparing the files in the volumes one by one after mounting the clones I find no difference. I suspect a corruption of the NTFS file system structure in the clone because the metadata changed while ntfsclone was doing the copy but I can't tell for sure.
I have this file with this format: AAA 777 KKK and then another with this format: AAA KKK 777 Can I merge them somehow with some Linux magic ? There's thousands of entries in each so I just want to makes the second file in the same format so I can merge them. Thank you !!
Asked in: ShellScripts  (1 answers)
s's response: Look at the join(1) command (note that the files need to be sorted by the joining column). ( export LC_ALL=C join -1 2 -2 2 <(sort -k2,2 file1) <(sort -k2,2 file2) ) to join on 2nd column for instance.
Is this possible on Linux ? When I use ifconfig it always needs the network interface brought down and then up again. I'd like to change the MAC address without resetting it.
Asked in: Linux-Servers  (2 answers)
s's response: Have you tried this ? ip link set address xxx dev yyy
I get a summary of recursive file sizes with: du -h and get a summary of current directory file sizes with: du -h * Why ? Thanks.
Asked in: ShellScripts  (3 answers)
s's response: What do you mean? du -h and du -h . are the same. When you use: du -h * the shell expands * to the list of files and directories (except those whose name starts with a dot) in the current directory. du won't report disk usage of non-directory unless they are explicitly passed as arguments. Or you can use the "-a" option.
Rather than ARP broadcasting and checking with arp -a are there any quicker ways to probe who is uses which MAC addresses on a LAN without causing the server to get much busier ? Thanks.
Asked in: Linux-Servers  (2 answers)
s's response: You can query your switch if it has that information: snmptable -v2c -c public switch-address .iso.org.dod.internet.mgmt.mib-2.ip.ipNetToMediaTable Otherwise, there's no magic, you'll have to probe using nmap for instance, or watch all the traffic. broadcast ping might work depending on the OS of the hosts and firewall settings as well.
Can I easily set one up on our LAN to stop lots of downloads from outside the LAN ? It should save bandwidth a bit.
Asked in: Debian-Linux-Servers  (2 answers)
s's response: You could try one of those: $ apt-cache search proxy '\bapt\b' approx - caching proxy server for Debian archive files apt-cacher - Caching proxy for Debian package and source files apt-cacher-ng - caching proxy server for software repositories apt-p2p - apt helper for peer-to-peer downloads of Debian packages debtorrent - bittorrent proxy for downloading Debian packages
This is a long shot ... is it possible to change the default way that Ubuntu displays the date formatting ?
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: Using the LC_TIME environment variable, you can define which locale to use to display the dates. You can define more locales using localedef. Those definitions can be put in a non-standard location, and you can tell that specific location to applications using the LOCPATH environment variable. For instance, you can adapt an existing locale definition: $ cp /usr/share/i18n/locales/en_GB mine.src $ perl -CIO -pi -e 's//eval "\"\\N{U+$1}\""/eg' mine.src (to make it more legible) $ vi mine.src (change what you need like month names, date_fmt) $ zcat /usr/share/i18n/charmaps/UTF-8.gz | localedef -i mine.src -f /dev/stdin -c ~/.locales/mine $ grep date_fm mine.src date_fmt "%a %F %T %Z" $ LANG=mine LOCPATH=~/.locales date FRI 2011-06-24 14:18:38 BST
This is failing for some reason - all I want is working regex for a valid email address in any PHP function that works ! if (preg_match('/^([a-z0-9_-]+)(\.[a-z0-9_-]+)*@([-a-z0-9]+\.?)+\.[a-z]{2,4}$/i', $email)) { execute ... } Mmm. Any ideas ? Thanks.
Asked in: OtherProgramming  (2 answers)
s's response: http://www.linuxjournal.com/article/9585?page=0,3
Can I forward requests to port 80 to port 8080 with SSH ? Or how should I do it if not ?
Asked in: Linux-Servers  (2 answers)
s's response: On the same machine? You could, but that would be a waste of resource. You can do it using iptables with the REDIRECT target: sudo iptables -t nat -I OUTPUT -p tcp --dport 8080 -m addrtype --dst-type LOCAL -j REDIRECT --to-port 80 sudo iptables -t nat -I PREROURING -p tcp --dport 8080 -m addrtype --dst-type LOCAL -j REDIRECT --to-port 80 Or you could do it with socat: socat tcp-listen:8080,reuseaddr,fork tcp:localhost:80 (if I understand your question correctly)
I want to run a mail server (mostly outbound), Apache and mysql on a server. I expect about 100,000 page impressions a month and the pages will have some flash and some images. How much RAM do I need and can anyone point me at realistic spec that won't slow down the site ? Thanks a lot.
Asked in: Linux-Servers  (2 answers)
s's response: Flash is not a burden on the server, more on the client. From the little you specify, it's hard to tell, but you probably won't need much. Start with an old PC (pentium 4, 512MB of RAM) and see how it copes.
I'd like to add an IP address to /etc/hosts.allow under some circumstances inside a shell script and I'd like to also have a command executed if an untrusted IP address then tried to connect to a specific TCP port via TCP wrappers. I can't go into too much detail for security reasons but is this scenario possible ? If so how ? I'd be grateful for any help.
Asked in: Ubuntu-Linux-Servers  (1 answers)
s's response: Yes. See host_access(5).
I'm writing an essay and would like to know how it's categorized please. Many thanks.
Asked in: Linux-Servers  (2 answers)
s's response: It becomes a server when you intend it to be, that is when it is meant to serve something to someone else. Though it might still stay a desktop if you're using it as your workstation. There's no reason why one machine can't be both.
How can Ubuntu suddenly want to make my default shell Dash and not Bash ? I don't understand why it's asking me that question during a package install and why they have moved away from Bash. Thank you.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: I think you mean default /bin/sh. Ubuntu moved over to dash for /bin/sh a long time ago. Though you still have the option to move back to bash in case you have some broken /bin/sh scripts that rely on some non-POSIX features. Bash is probably the worst shell around in terms of performance, so it's a bad choice for interpreting scripts. Shells based on pdksh or dash are usually a lot faster. It's also very poor in terms of interactive features when compared to zsh or tcsh. The main reason why bash is so universal is because it is the shell of the GNU project.
Can I only receive unique results from a MYSQL fetch row easily ? Instead of just the top ten if there are repetitions can I just get the unique entries, even if it gives me twelve results for example ? Thank you.
Asked in: OtherProgramming  (1 answers)
s's response: Use "DISTINCT": http://dev.mysql.com/doc/refman/5.5/en/select.html
I get these errors a lot in my mail logs and I've added the authority to the system: certificate verification failed for gmail-smtp-in.l.google.com untrusted issuer /C=US/O=Equifax/OU=Equifax Secure Certificate Authority I've also tried numerous other suggestions. Any managed to solve it on Postfix ?
Asked in: Debian-Linux-Servers  (1 answers)
s's response: Make sure postfix's smtp_tls_CApath points to the list of trusted CAs. On a debian based systems, that would be /etc/ssl/certs and you choose which CA to trust with sudo dpkg-reconfigure ca-certificates
It's a long story ... I need to count the number of .html and .jpg images in about thirty subdirectories in Linux. I looked at using find but it's really difficult !
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: Try: find . | sed 's/.*\.//' | sort | uniq -c | sort -rn
Can I print out a simple directory tree for reference on the command line in Ubuntu Server ? Is there such a command ?
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: Look at the "tree" package and command.
I don't need to do this on a new server just yet but other than using apt-get clean, to remove downloaded package files, how else can I clear up disk space safely on Ubuntu Server ? Thank you.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: You can remove old kernels. Use aptitude and sort by installsize (press S, then type installsize) to see if you really need the large ones. See if there are log files that went out of control. run: du -ax / | xdu To see where the disk space is consumed...
I thought I should add a line to my .bashrc file in my home directory. export PS1='\e[1;32m[\u@\h: \W \t]\$ \e[m' Text is bizarrely over-running each single line now and then the text just overwrites the current line. I know I can just remove it but why is that happening ? Thank you.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: Bash gets confused because e[1,32m although 7 characters has zero width when displayed. You've got to tell it that by using [, ] to enclose the zero-width parts see the manual for details.
Is there a way to use the copy command in Linux to only copy files from the current partition (excluding /proc for example) ?
Asked in: ShellScripts  (1 answers)
s's response: If you're using rsync or bsdtar or GNU tar, use the --one-file-system flag rsync --verbose --progress --stats --archive --one-file-system --xattrs --hard-links --delete --numeric-ids --sparse --acls src dst (cd src && bsdtar -cf - --one-file-system .) | (cd dst && bsdtar xpSf -) Alternatively, you can do a mount --bind src /some-mountpoint Then /some-mountpoint will not have the extra fs mounted on (you may find that those were masking some files in the original filesystem, so that two methods are not strictly equivalent).
Which RSS feeds or mailing lists should I be subscribed to for keeping an eye out for Ubuntu security updates and other problems with specific Ubuntu server ? Thank you for your guidance.
Asked in: Ubuntu-Linux-Servers  (5 answers)
s's response: Sorry, my bad, I meant the mailing list ubuntu-security-announce@lists.ubuntu.com See https://lists.ubuntu.com/mailman/listinfo/ubuntu-security-announce for how to subscribe. See also http://www.ubuntu.com/usn and http://www.ubuntu.com/usn/rss.xml
Which RSS feeds or mailing lists should I be subscribed to for keeping an eye out for Ubuntu security updates and other problems with specific Ubuntu server ? Thank you for your guidance.
Asked in: Ubuntu-Linux-Servers  (5 answers)
s's response: security@ubuntu.com
How do a run safe script (that won't go into a loop and cause problems) continually to check another server's downtime remotely ?
Asked in: Linux-Servers  (1 answers)
s's response: ping www.google.com | perl -lne 'utime undef,undef,"some-file" if /bytes from/' would update the last modification and access time of "some-file" every time you get an answer from ping to the address. So the age of the file will give you how long the server has been down for. You may want to consider using the -i option of ping, to ping less often than every second.
How can I tell how long my old DNS record will be cached for ? I moved the www entry to a new IP but lots of people still see the old record.
Asked in: DNS-Servers  (1 answers)
s's response: $ dig +noall +answer www.servercircle.com www.servercircle.com. 300 IN A 194.36.163.64 That one can be cached up to 300 seconds. $ dig +noall +answer www.foxxy.com www.foxxy.com. 21600 IN A 66.37.28.236 That one 6 hours...
How can I tell which port is opened by which application so I can shut it down ? Sometimes netstat output is really obscure so is there a fool proof way ? Thanks.
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: $ sudo lsof -nPi tcp:22 | grep LISTEN sshd 2710 root 3u IPv4 9766 0t0 TCP *:22 (LISTEN) sshd 2710 root 4u IPv6 9768 0t0 TCP *:22 (LISTEN)
Is there a way to make it much less resource hungry in Linux ? I think nice just affects CPU usually.
Asked in: Linux-Servers  (2 answers)
s's response: Look at ionice.
How do I replace whitespace in a variable with nothing, ie delete it ? What's the best tool ? The variable could be: $variable = "Just a sentence"; and I'd like it to be: "Justasentence". Thanks !
Asked in: Linux-Servers  (5 answers)
s's response: A note on sed's \s. Note that it's not standard, only found on some implementations like GNU sed. The standard equivalent would be:
sed 's/[[:space:]]//'
But note that that includes more that space and tab. The [:space:] character class includes ^I (HT, \t), ^J (LF, \n), ^K (VT, \v), ^L (FF, \f), ^M (CR, \r). But sed won't remove \n. tr -d '[[:space:]]' would remove LFs as well.
How do I change the language settings on Ubuntu Server ? Thank you.
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: On a per-process basis, use the LANG and/or LC_* environment variables. Globally, you can set the default locale by editing /etc/default/locale by hand or using update-locale. You can see the list of available locales with locale -a. You can compile more locales using locale-gen after having edited /etc/locale.gen
Is blowfish still the best compression for SSH ? Thanks.
Asked in: Linux-Servers  (1 answers)
s's response: I think you mean "encryption". Fastest compression would be achieved with --compress-level=1 (if by fastest you mean least CPU intensive in case the CPU is the bottleneck; if the bandwidth is the bottleneck, use higher compress levels). For the fastest encryption, try arcfour instead.
Is this quite easy ? I've never done it before in Linux. Cheers.
Asked in: Linux-Servers  (3 answers)
s's response: See taskset(1)
I'm looking for one that will work with Debian and Ubuntu Servers ideally. Where would I get one ? I'm in the UK.
Asked in: Debian-Linux-Servers  (4 answers)
s's response: USB2106S StarTech Compact USB 2.0 works fine and is cheap. based on MosChip MCS7830 Beware that some very cheap ones are USB 1 so won't achieve the full 100Mb/s speed
I lost a file when moving it inside my pendrive memory. Can I retrieve it?
Asked in: Linux-Servers  (5 answers)
s's response: The answer will depend on the filesystem being used. For ext2,3,4, see e2undel or recover.
How can I print a few lines of legal stuff when someone logs into our servers at work ? Something that says they can be prosecuted for doing bad things etc.
Asked in: Linux-Servers  (3 answers)
s's response: Note that PrintMotd is handled by ssh itself and is independant from the PAM one. So if you have PrintMotd and PAM enabled and pam_motd configured for ssh, then the motd file will be displayed twice. Via the pam_motd configuration, you can specify an alternative file to /etc/motd.
How do you go about making a cable to connect into a serial port of a device over the console ? I need to have console access to a switch from a server. One end is like ethernet (CATV) and the other is the grey serial type end. Cheers.
Asked in: Linux-Servers  (2 answers)
s's response: You could look for your switch at http://www.allpinouts.org/ ethernet end would be RJ45 and other end DB9, but pin assignment are likely to be different from one brand to the next.
How can I print a few lines of legal stuff when someone logs into our servers at work ? Something that says they can be prosecuted for doing bad things etc.
Asked in: Linux-Servers  (3 answers)
s's response: Via pam_motd for instance (using /etc/motd or an alternative file for ssh only). See pam_motd(8) for details.
How do I generate a log of errors from my bash script ? Cheers.
Asked in: ShellScripts  (2 answers)
s's response: Inside the bash script, you can do at the start: exec 2>> /var/log/myscript.log Or to use syslog: exec 2> >(logger -t myscript) (that one may still not work with bash so you may need instead to wrap your whole script in { { ... } 2>&1 >&3 3>&- | logger -t myscript 3>&- } 3>&1
I use hping like this: hping -i eth0 -c25 -S 123.123.123.123 -p 80 Is this creating a SYN packet correctly ?
Asked in: Server-Networking  (1 answers)
s's response: I would have said yes, but doing it myself and checking with wireshark (and comparing with the packet generated by telnet 123.123.123.123 80), it's not valid because it's got a non-zero ack field even though the ACK flag is not set. Adding -L 0 would probably make it correct.
I use "CTRL-A" then "d" to detach my session in screen before I log out but if I forget and the SSH session timeouts then screen -r doesn't work always. What am I doing wrong ? Is there another way to reattach the session ? Thanks.
Asked in: Linux-Servers  (2 answers)
s's response: screen -x attaches to a screen session even if it's already attached elsewhere.
Is it possible to change a jpg to a png file on the Linux command line ? Sometimes I have to do this and it involves downloading the file and working with it on a desktop, then uploading it again. I'd like to be able to resize the width and the height of an image from the command line without a GUI too. Any packages that do this ?
Asked in: Linux-Servers  (3 answers)
s's response: BTW, note that converting from jpeg to png doesn't really make sense. png is for loss-less compression, but compresses generally less that jpeg. If your image was jpeg, then it's already lost, converting to png won't make it recover what it has lost. png compresses well for some kinds of images (those for instance that have large zones of the same colour), but typically, when converted to jpeg, those zones will no longer be uniform...
How do I get e-mails about any security patches that need updated ? Cheers.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: You could subscribe to the security@ubuntu.com mailing list.
I think I saw a few lines of code that meant TCP wrappers that are probed send an e-mail to the admin telling them. Are they any examples any one can point me at ? I'd like other clever uses of tcpwrappers too if possible as well as emailing the admin if a port or service is scanned. Thank you.
Asked in: Linux-Servers  (2 answers)
s's response: See hosts_options(5)
Is there a tool to look up an IP address from a MAC address, I suppose it's in reverse to the normal way of doing it ? Cheers.
Asked in: Ubuntu-Linux-Servers  (1 answers)
s's response: I'll assume you're talking of IPv4 here. Note that one MAC address can have more than one IP addresses, not all of which may be on the same subnet as yours on the same link. You can use arping. That will not necessarily work. If you don't get any answer, you can always try with variations of the -0, -b, -T -s... options. If it might be a router, you can try and get it to send an ICMP unreachable (with a short TTL or to an unexisting address. Alternatively, you could query the switch if it's got a SNMP interface as it might have that information: snmptable -v2c -c public switch-address .iso.org.dod.internet.mgmt.mib-2.ip.ipNetToMediaTable
I'm getting slow ftp uploads to my FileZilla server from the internet side of the router using FireFTP - typically speeds of only about 10Kb (inside the LAN everything's speedy enough). The speeds initially start out much higher - 100Kb+ - but rapidly drop to 10Kb or less. This is despite the broadband speed of the connections at each end being around the 10-meg mark. I tried FileZilla Client - same thing. I have no speed limits, global or individual user, set. Maximum number of threads is set at 10 and the number of connections is set at 0 (unlimited) for future use, but these slow speeds are happening during the testing phase of setting up the server with only one user defined and connected. Any ideas what could be the cause of this? Are there any good diagnostic tools in people's toolkits that might help me find the cause if there is one?
Asked in: Linux-Servers  (11 answers)
s's response: Are you transferring one big file or plenty of small files?
In Linux are there any ways to monitor which user reads or writes to a file or directory and log it for reference ? I use the Ubuntu Linux Server.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: The Linux kernel feature you need is called inotify. On a debian-based system, see apt-cache search inotify on other systems, that might be yum search or zypper search. for packages that would be of interest to you.
Is it possible to change a jpg to a png file on the Linux command line ? Sometimes I have to do this and it involves downloading the file and working with it on a desktop, then uploading it again. I'd like to be able to resize the width and the height of an image from the command line without a GUI too. Any packages that do this ?
Asked in: Linux-Servers  (3 answers)
s's response: With ImageMagick: convert -resize 100x100 file.jpg file.png With netpbm: jpegtopnm < file.jpg | pnmscape -h 100 -w 100 | pnmtopng > file.png
How would I write a script to process a few thousand IPs with their WHOIS records into a text file afterwards ?
Asked in: Linux-Servers  (3 answers)
s's response: Assuming the IP addresses are in a text file (newline or blank separated): xargs -n1 whois < list.txt > whois.txt
I've been told to cache images in the browser so there's less bandwidth used by our website. I thought web designers did this. Can you do it in Apache ? I've gone for Ubuntu Server now that LAMP is working !
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: You can given hints to clients and proxies through the Cache-Control header. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 for details.
Can I switch off listing files so people can't see the files in the folder ? In Apache ?
Asked in: Linux-Servers  (2 answers)
s's response: Either put an empty index.html or remove the Indexes option for the corresponding directory.
I want to know when someone runs a traceroute to my server. Is this achieveable ?
Asked in: Linux-Servers  (1 answers)
s's response: Look for incoming UDP or ICMP ECHO_REQUEST packets with a TTL of 1. For instance for ICMP: sudo iptables -I INPUT -p icmp --icmp-type echo-request -m ttl --ttl-eq 1 -j LOG ...
How do I only allow some IP Addresses access to my SSH Server on Ubuntu Server ? Thank you.
Asked in: Cloud-Servers  (2 answers)
s's response: That can be done at different levels: - firewall - pam (through pam_access) - tcpwrappers - sshd config - authorized_keys file If you do it at firewall level, then the sshd process won't even see the incoming connection, and you can hide the fact that there is a ssh server running. At pam level, you can enable pam_access in /etc/pam.d/sshd and configure access with /etc/security/access.conf In sshd_config, see AllowUsers, DenyUsers For tcp wrappers, see /etc/hosts.allow, /etc/hosts.deny And in the authorized_keys, you can restrict access per key with "from" parameters.
I'm looking for a lightweight script to generate as much UDP traffic as possible on my server's 100Mbit connection for penetration testing. Any recommends ? Thanks.
Asked in: Server-Networking  (2 answers)
s's response: You can look at iperf. See also socat in combination with pv for instance.
Can someone please help me with a regex in Bash ? I need to match an IP address ? Thank you.
Asked in: ShellScripts  (4 answers)
s's response: Depends what you mean by IP address. 0xfff 1.123 ::1 are all valid IP addresses. If you want to restrict to quad-decimal notations for IPv4 addresses, you could use:
perl -MSocket -e 'exit 1 unless Socket::inet_pton(AF_INET, $ARGV[0])' address-to-check
For IPv6 addresses:
perl -MSocket -e 'exit 1 unless Socket::inet_pton(AF_INET6, $ARGV[0])' address-to-check
I'd like to copy an entire disk containing my opensuse OS exactly as it is over the network. I can't figure out rsync options. Can I use dd across a network somehow ? What's the best approach ?
Asked in: Suse-Linux-Servers  (3 answers)
s's response: If you're using LVM, you can transfer a live fs using LVM mirrors with nbd devices. I can expand on that if anybody's interested.
I've been told to cache images in the browser so there's less bandwidth used by our website. I thought web designers did this. Can you do it in Apache ? I've gone for Ubuntu Server now that LAMP is working !
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: What do you mean. Browsers will generally cache by default, unless you tell them not to or use different URLs for every image.
Cut and paste doesn't always work when SSHed into a server. Traditional cut and paste does but not highlighted text. It's hard to say exactly when it fails but it is frustrating when it does. Anyone noticed this too ?
Asked in: Ubuntu-Linux-Servers  (1 answers)
s's response: Not sure what you mean, but you can always use GNU screen and its internal copy-paste facility.
Sometimes I need to find package version numbers quickly but I can't figure it out in Ubuntu (and presumably Debian too).
Asked in: Ubuntu-Linux-Servers  (1 answers)
s's response: installed packages? dpkg -l available packages? apt-cache show If you're using zsh or bash-completion, you'll get completion for the package names.
I can't get tcpdump to stop sniffing the network after a certain number of packets. The man page says it's possible but the syntax is obviously tricky. It's Debian if you need to know. Can anyone else tell me please ?
Asked in: Debian-Linux-Servers  (2 answers)
s's response: What did you try? tcpdump -i eth0 -c seems to work for me.
I'm pretty new to writing shell scripts in Bash. My scenario is: Every time "counter" is present in a text file I need to add a line "The count was present with a total of $counter". What's the best tool to use in Bash ? I could use "grep" to find the occurrence but then how would I increment $counter and append a line straight after "counter" ? Thanks.
Asked in: ShellScripts  (4 answers)
s's response: Not sure what you mean, would this do? perl -lne 'print; print "The count was present with a total of " . ++$counter if /counter/'
I need to convert about 200 old style mailboxes into Qmail's Maildir format. What's the best way to do it ? They're not very big. Can someone help ? I will offer a £5 Amazon voucher and the fifty points for the best answer. Please state which Amazon site you'd like the voucher from as sometimes you can't spend them in different countries. Thanks.
Asked in: Email-Servers  (5 answers)
s's response: $ apt-cache search convert mbox maildir mb2md - Converting Mbox mailboxes to Maildir format
Are there any security reasons why ssh_config should only be readable by root. I think it's safer to keep details about key services like SSH private from local users (by tightening up sshd_config) but is the SSH config file "important" ?
Asked in: RedHat-Linux-Servers  (2 answers)
s's response: ssh_config should be readable by everyone as it's the default configuration for "ssh" used by everyone. sshd_config can be made readable only by root if you don't want users to know how it is setup or if there's sensitive information in there (there wouldn't be by default)
Why doesn't this work ? I'm sure that it's right !! $first=$(awk '{print $1}' $single);
Asked in: ShellScripts  (4 answers)
s's response: first=${single%% *} Or: set -f unset IFS set -- $single first=$1
Is this possible on Linux or Windows ? I'm only given one IP by my host.
Asked in: Linux-Servers  (5 answers)
s's response: Or simply use different ports.
Is there a way of seeing the changelog file before upgrading a package on Debian or Ubuntu ? I see to have to upgrade first and download the package and install it and then I can see the changelog.
Asked in: Debian-Linux-Servers  (1 answers)
s's response: sudo dpkg-reconfigure apt-listchanges
Does anyone know of a list of the Ubuntu LAMP packages (on the installation screen near the end of the install, it says "install a LAMP server") that are actually installed ? That would be great.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: tasksel --task-packages lamp-server
How do I find out which packages support TCP wrappers ? I know SSH does but what about others ? Thanks in advance.
Asked in: RedHat-Linux-Servers  (6 answers)
s's response: See also $ rpm -q --requires openssh-server | grep wrap libwrap.so.0()(64bit)
How do I find out which packages support TCP wrappers ? I know SSH does but what about others ? Thanks in advance.
Asked in: RedHat-Linux-Servers  (6 answers)
s's response: ldd "$(command -v sshd)" | grep libwrap would check if sshd links against libwrap from the TCP wrappers
There's something that just baffles me right now and I'm out of ideas. Would anybody have some idea? Basically, I have a Dell PowerEdge R415 rack server. Running xen 4.1 with a debian squeeze dom0. On two occasions (and now is the second one), I see weird behaviours as follows: I've got a ssh connection open from my workstation to the server and it works. However, I cannot ping it nor establish new TCP connections. I can see the packets go out of the workstation interface, the switch claims it forwards it to the server, but I cannot see them on the server with tcpdump, nor do the interface statistics increase. I can see the same from other workstations while others are OK. What really baffles me is that there is an established and working ssh connection. Initially, I was seeing the "dropped" statistics increase, and ethtool -S eth0 on the server showed some rx_fw_discard, but after increasing the rx ring buffer that went away, but still same problem. There's a bridge br0 with eth0 and the virtual interfaces for the Xen domUs, everything looks fine there. That server has a BMC with a net interface with a different MAC address. I can ping the bmc from my workstation, but not from the server. That BMC shares the same physical network connection (I'm not sure how that works, if there's an internal bridge in the server, could it be where the problem lies?) That's a Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet # ethtool -i eth0 driver: bnx2 version: 2.0.2 firmware-version: 5.2.3 NCSI 2.0.11 bus-info: 0000:02:00.0 From dmesg, the link went down a few times. I think the problem started to occur when a message like: NETDEV WATCHDOG: eth0 (bnx2): transmit queue 7 timed out appeared in dmesg. Any idea? Update (2011-05-11) - same problem with opensuse with Xen 4.1 and 2.6.37-xen dom0 kernel. - upgrading to bnx2 2.0.23b from Broadcom's site improves matters (at least if I boot with this one, not if I unload the old one and load this one) especially if I increase the size of the receive ring buffer. I'm under the impression that those ethernet adapters do things at level 3 and 4 which worries me a bit
Asked in: Server-Networking  (8 answers)
s's response: strace on what :-) ? I might be speaking to soon, but I think I finally found a/the solution. To sum up, it now works with: 1- bnx2 driver updated to latest version from Broadcom (among other things, it allows a bigger receive ring buffer) 2- increased the rx ringer buffer to maximum size (4080) 3- increase coalescence rx-frames and rx-usecs to get fewer interrupts 4- allocated and reserved 2 CPUs to the dom0 (dom0_max_vcpus=2 dom0_vcpus_pin added to xen boot args, cpu-pins for guests not to include the first 2 cpus) 5- increased dom0 scheduling weight: xm sched-credit -d Domain-0 -w 512 Of those, only "4" I know is necessary. I've not tried with reverting the other ones, but now that I've got something running at last, I don't want to break it. I now even have a domU with PCI passthrough to one of the ethernet cards/ports and it works fine.
If I read right this means that sometimes you get a response from a different MAC because two are available on one Server and both interfaces can reply if something like ip_forwarding is enabled. Am I understanding correctly though ?
Asked in: Server-Networking  (2 answers)
s's response: The problem is more when the two interfaces are on the same subnet (which you shouldn't do anyway). See also the arp_ignore sysctl. See http://linux-ip.net/html/ether-arp.html#ether-arp-flux
How do I make sure my network always connects at 100Mb Full Duplex every time ?
Asked in: Debian-Linux-Servers  (3 answers)
s's response: http://wiki.debian.org/NetworkConfiguration#Setting_the_speed_and_duplex
Should I upgrade from Lenny now (oldstable) to Squeeze ? I know it says oldstable is available for security upgrades for a while but how long in reality is that ?
Asked in: Debian-Linux-Servers  (4 answers)
s's response: http://www.debian.org/security/faq#lifespan you've got a year to switch at most.
I'm looking for remote IP KVM suggestions for about up to 200EUR or so. Any takers ?
Asked in: WindowsServers  (3 answers)
s's response: What I can tell you is that I'm not particularly impressed by ATEN's ones. We've got the cs1716i. The java client interface takes 100% of CPU on Linux (in a loop reading from the X11 socket set as non-blocking), the keyboard often doesn't work (including on the local console) like layout completely messed up, or nothing at all or keystrokes sent by bursts, needs to be rebooted from time to time...
I am using: aptitude install apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2-suexec libexpat1 ssl-cert for the Apache installation and: aptitude install php5 apache2-mpm-prefork libapache2-mod-php5 php5 php5-common php5-mysql php5-xmlrpc for the PHP installation. Do I need all of the PHP files for a base installation ? Like php5-xmlrpc and apache2-mpm-prefork ? Thank you in advance.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: The MPM is like the apache engine. You need one. When using mod-php5, I think you can only use the prefork or itk engines. You only need to install libapache2-mod-php5, all the other needed packages will be installed automatically. If you want to write php code that accesses a mysql database or processes xml... you can install additional php5-xxx packages. Again, only install what you actually need. That way when you no longer need it, you don't have to worry about what to uninstall. If you want to use a php5 package that uses mysql, again, don't install php5-mysql, only install that package and it will install php5-mysql as a dependency. Only install php5-mysql (or mark it as manually installed) if you're doing some php5+mysql stuff that is not /packaged/ by ubuntu (such as php5 code you write yourself)
I want to be able to control how much inbound traffic the IPs on my Server receive (I've replaced the IP with one from a private range in the example below). DEV=eth0 tc qdisc del dev $DEV handle ffff: ingress tc qdisc add dev $DEV handle ffff: ingress tc filter add dev $DEV parent ffff: protocol ip prio 1 u32 match ip dst 10.10.10.10 police rate 1Mbit burst 250k drop flowid :111 This seems to work just fine but when I drop the 1Mbit parameter in tc to anything less than 256kbps the results go all screwy. Any fixes ? Is this just perculiar to the ingress qdisc ?
Asked in: Server-Networking  (3 answers)
s's response: Do you reduce the burst while you reduce the rate? Having a large burst might cause bad interference with the TCP congestion algorithm (wild guess). Do you really need to do that on the ingress? You could also mark packets coming from eth0 and use that as a basis for classifying on the egress discipline of the interface where 10.10.10.10 is to be reached via. That would mean you could do shaping rather than policing. You may also want to consider IMQ instead. You could also try using just iptables -m limit.
Is there always a variable in a PHP script for fonts being pushed into something like a PDF converter or is it set "globally" ? How can I change it ?
Asked in: OtherProgramming  (2 answers)
s's response: php doesn't know anything about fonts. If you have some software written in php or any other language that generates PDF, please refer to that software documentation to see how to specify the font to use.
I want to get some text log files off this practice server I'm building. Since it's currently offline, I'm thinking to copy them to a USB stick. I put the stick in, and it doesn't apppear under /mnt What do I need to do to use the USB stick?
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: (assuming there's no LVM or encryption... on the USB drive), the traditional way: find out the device for the partition on the USB drive your want to mount. (see dmesg | tail or /proc/partitions) or find /dev/disk -ls, for instance /dev/sdb1 and mount it as mount /dev/sdb1 /somewhere Alternatively, you can install the "usbmount" package that mounts removable devices automatically, or you could setup the automounter to automatically mount drives when they are accessed (like "cd /media/sdb1" would mount /dev/sdb1 into /media/sdb1...)
I have an old XP box I just use as my small business LAN server. Recently, it's stopped booting. Hangs at a black screen with a white flashing cursor. I can reach BIOS, and all the hardware is still OK. What's the problem, and how might I fix it?
Asked in: WindowsServers  (1 answers)
s's response: common problem, but zillions of possible causes. Try booting the recovery console from your windows CD to see if it can still see your windows installation on the disk, and then try the fixmbr, fixboot... You could try various tools on the HIREN CD to diagnose and/or fix the problem. But chances are you're going to be facing hours of frustrations. If the hardware is still OK, the easiest is probably to do a backup of your disk, recover from the previous backup and see if you're missing data.
I have a new Server - SSH logins work but take forever to start up. My bandwidth is fine. I can't begin to guess what it is. 50 of my points available for help, it's driving me nuts.
Asked in: Server-Networking  (8 answers)
s's response: If it's a DNS resolving issue, it's easy to check: on the server, after login via ssh (the one that takes ages), run getent hosts ${SSH_CLIENT%% *} if that takes ages, then that's the issue. If not, try a getent hosts on the hostname returned by the command above. If it is due to DNS resolving issue, best would be to resolve your DNS issues. If that's not possible you can put "UseDNS no" in your sshd_config. Is the server running ubuntu? Then it could also be due to the pam_motd PAM module that on some ubuntu version dynamically generates a /etc/motd file upon login, and that can take a very long time. It would be helpful to see the output of ssh -v hostname and see where it hangs. You may also want to change the sshd LogLevel to "debug" to get more information. Check your syslog configuration to see where sshd messages end up. The could be found in /var/log/syslog, /var/log/auth.log, /var/log/messages, /var/log/secure, even /var/adm/messages depending on the system.
I have a new Server - SSH logins work but take forever to start up. My bandwidth is fine. I can't begin to guess what it is. 50 of my points available for help, it's driving me nuts.
Asked in: Server-Networking  (8 answers)
s's response: I've seen that before when sshd fails to resolve the hostname of the client. Running the ssh command with -v might give other suggestions.
I'm pretty sure that when the latest Ubuntu was released the Ubuntu update servers ground to a halt and were unavailable at points when I was doing package installs. How do I change gb.archive.ubuntu.com if that happens again ?
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: Change all occurrences of "gb.archive..." to for instance "se.archive..." in /etc/apt/sources.list and files in /etc/apt/sources.list.d, run an apt-get update and try again.
I'm new to IT and need to be able to measure packet loss between our two office file servers. They connect over an SDSL line.
Asked in: Server-Networking  (6 answers)
s's response: Why? packet loss is normal and expected. That's how it's meant to work. TCP adapts its flow by adapting the rate at which it transmits based on packet losses (basically, it increases the rate until packets start to be missing (at which point it drops the rate and retransmits and starts to increase the rate again). On Linux, "netstat -s" and/or /proc/net/netstat will give you indications of packet loss and retransmissions.
I've heard that some attacks originate from spoofed Private LAN IPs but I'm not sure how I would go about setting my web server up to ban them. There's a 100 points reward for the best answer. Thanks.
Asked in: Server-Networking  (7 answers)
s's response: "route reject" or "route blackhole" stops you from *sending* to those hosts, not from receiving. rp_filter filters incoming packets. If rp_filter is "1" and an incoming packet is coming with a source address of "X" on interface ethy and the route to address X is not via interface ethy but via interface ethx (or via a blackhole route), then that packet will be discarded. With rp_filter on, then it makes sense to add blackhole or reject routes so Bogofilter's answer still applies. Note however that it may be valid for packets to be coming from a different route from the return one depending on the network topology, so that's to be used with care.
I need to know if there's too much noise on a subnet so I'd like to automate a way of telling me how many broadcast and multicast pps (packets per second) are on a subnet. I can't figure out a good way of doing it though. I'm keen to keep my hard earned points so I'll happily give a £10 Amazon Voucher to the Best Answer (the voucher can be towards your preferred Amazon site: .com, .fr, .de or .co.uk etc).
Asked in: Server-Networking  (6 answers)
s's response: I just noticed that not all versions of netstat on Linux give the same information (for instance squeeze's doesn't give you the multicast statistics). You can also get the information directly from /proc (/proc/net/snmp, /proc/net/netstat, /proc/net/snmp6). You can also install a snmp agent on the server to be able to query that information remotely (and locally as well). snmptable -v2c -c <community> <hostname> .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable snmptable -v2c -c <community> <hostname> .iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable
So, I installed Ubuntu Server 11.04 on an old laptop, intending a Python build environment. Anyway, install is all easy. I have command line access to the system. My problem is that both the onboard Ethernet does not seem to be detected; /sbin/ifconfig only brings up a Loopback address. So, how do I get online?
Asked in: Ubuntu-Linux-Servers  (1 answers)
s's response: ifconfig will only show interfaces that are up on Linux. Try ifconfig -a. If still not, run lspci to see what ethernet controller you have and look for driver availability. Look at the dmesg output to see if there's useful indication of why the device is not recognised (missing firmware...)
I've heard that some attacks originate from spoofed Private LAN IPs but I'm not sure how I would go about setting my web server up to ban them. There's a 100 points reward for the best answer. Thanks.
Asked in: Server-Networking  (7 answers)
s's response: Adding blackhole routes won't help much here.The incoming packets will be processed (so for instance, that doesn't stop SYN floods or non-TCP based attacks). And if the server is connected to private subnets (it is at least for 127.0/8), those blackhole routes will be preempted (and that's where it's going to be more of an issue) Using rp_filter looks more like the correct answer to that question: sysctl -w net.ipv4.conf.all.rp_filter=1 For Linux, see Documentation/networking/ip-sysctl.txt in the linux kernel sources.
I seem to be dropping packets on my main NIC but the server load isn't busy or is it flooded with traffic on the NIC: RX packets:4197379 errors:32323 dropped:27993 overruns:0 frame:0 TX packets:6993341 errors:0 dropped:0 overruns:0 carrier:0 How do I diagnose these errors ? It's an Realtek RTL8111/8168B and Ubuntu Lucid Lynx.
Asked in: Server-Networking  (4 answers)
s's response: Possibly the packets are dropped because they are invalid frames (too short, too long, ethernet checksum failure...) If on Linux, ethtool -S eth0 or cd /sys/class/net/eth0/statistics && grep . * might give more information.
I'm looking for invoicing HTML and PHP to PDF packages. Any experience of good ones ?
Asked in: OtherProgramming  (2 answers)
s's response: php to pdf doesn't really make sense. What you want is the result of the interpretation of php code by some web server (which will be HTML most of the time, but can anything else) converted into pdf. There exist a number of opensource solutions (http://www.xhtml2pdf.com/, http://code.google.com/p/wkhtmltopdf/ for example), and you can use solutions that convert to intermediary formats like postscript, djvu... tcpdf mentioned by ChrisWaddle already looks more what you actually need though.
I'm new to these. How do they work, if I serve it from PHP for example ? Thanks for any assistance you can provide me.
Asked in: ShellScripts  (3 answers)
s's response: A RSS feed is just an xml file that clients pull from time to time. See this site's one as an example of what it looks like: http://www.servercircle.com/xrss.php (save it as a file and open with a text or xml editor). See for instance http://www.ibm.com/developerworks/xml/library/x-phprss/index.html for more information and code to generate RSS data.
Has anyone done this before ? How does it work ? Can I simply run the absolutely essential read/write directories from RAM, like /proc etc ? You can probably tell I'm a newbie when it comes to this :-) --EDIT-- This is for a Debian Server and I'd like the FS read-only so that it's more secure.
Asked in: Linux-Servers  (1 answers)
s's response: You can make your life easier by using a union mount using aufs or unionfs-fuse. Basically, you make one FS (U) out of several ones that are /unioned/ together. In your case, 2 FS, one read-only (like a on a cloop or compressed btrfs on your usb tick (R) ) and one writable in RAM (tmpfs typically) (W). When you write on U, it create a file on W and writes to it. When you read from U, it reads from R unless the file was created on W.
Upgrading from Lenny to Squeeze I keep getting not enough space left on the device errors. How can I free up space on the root partition without killing off my Lenny install and the potential to upgrade ?
Asked in: Linux-Servers  (2 answers)
s's response: Is /var on your root filesystem? You could try using xdu to see where the disk space is. If /var is on the root fs, try doing an apt-get clean before and mount /var/cache/apt/archives on another disk like a USB stick for instance.
I've tried lots of things but can't get this to load with my .bash_aliases. It used to work. Ideas appreciated.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: .bash_profile is the file interpreted by bash upon login (so in theory only for one shell instance in your whole login session). That's not the best place to put alias definitions that are not inherited by new shells. In your .bash_profile, you'll put things that are meant to be set only once, like environment variable definitions, login specific stuff... alias definitions should go in the interactive shell customisation file: .bashrc that is interpreted by every interactive shell. However, bash has a bug/misfeature in that login shells, even interactive ones don't read the .bashrc (it also has another bug in that some non-interactive shells read the .bashrc). To work around that, you generally add to your .bash_profile: case $- in (*i*) [ ! -f ~/.bashrc ] || . ~/.bashrc esac Doing the other way round as suggested here is definitely wrong. Alternatively, you could use zsh which is a much better shell.
I can set up AllowUsers in sshd_config to only allow certain people to log in but is there a an equivalent AllowGroup ? If so how does it work ? It would be easier to admin I think.
Asked in: Linux-Servers  (4 answers)
s's response: Note that you should also be able to use PAM. You can also specify what users/group are allowed to do with but writing some "Match group" "Match user" sections. See your man page for sshd_config.
I'm having trouble working out if my disks are slow. free -m and top show little problems. How can I check IO ?
Asked in: Linux-Servers  (2 answers)
s's response: See also iotop, dstat, iostat, /proc/diskstats. Check dmesg output in case of IO problems. You could check the smart status with smarctl -a. What usage scenario, what file system type? RAID? LVM? snapshots? What makes you think it's slow? See /proc/sys/vm/block_dump to check which process is doing what block IO. You can use hdparm -t/-T to do some basic senquential r/w benchmark, bonnie++ for more extensive ones.
I use lsof -i to look up which ports are open and to which application but I'd like more information on the application/daemon opening the port. Any ideas ?
Asked in: Linux-Servers  (2 answers)
s's response: What kind of information? What operating system are you using? Once you have the process ID, you can get all sorts of information with ps -p, lsof -p, strace/tusc/truss, /proc/...
Which file in kernel illustrates the CPU scheduling algorithm?
Asked in: Linux-Servers  (3 answers)
s's response: kernel/sched* though you may want to start with Documentation/scheduler/ or various articles at lwn.net or a good book on Linux kernel internals.
I've been manually creating index.html files in each of my subdirectories but how do I ban directory listing for the entire Apache server ? Should I do both do you think ? Thanks you.
Asked in: Linux-Servers  (3 answers)
s's response: If your web server is apache, just disable the Indexes option
        <Directory /var/www/your-directory>
                Options -Indexes
        </Directory>
Beware of .htaccess files that may re-enable them.
I have around twenty remote servers that I frequently need to upload a new XML to and then restart a daemon afterwards. The basic commands are: scp SourceFile user@host:directory/TargetFile I can do /etc/init.d/daemon restart How would I wrap them into a script which would do each server one by one ? Would I need another file with IP addresses of the servers to reference ? A hundred points to you for a script that works and the best answer points too. Thanks.
Asked in: ShellScripts  (4 answers)
s's response: Write the script that does this:
#! /bin/sh -
user=$1; shift
for server do
  ssh "$user@$server" < Sourcefile '
     cat > directory/TargetFile && /etc/init.d/daemon restart'
done
And then you can pass the list of servers as you like such as xargs < servers.txt your-script root
Control-C and other Control keystrokes don't get me out of a telnet session properly. How do I do it ? Thank you for your help.
Asked in: Server-Networking  (5 answers)
s's response: <Ctrl-]>, then enter quit
I have a box that dies (seemingly when it's busy) every now and again and needs rebooted to bring back up. It's not fun. The software has rarely changed and I can't find anything in the logs. It's only about a year old and can't be dusty or anything like that. Any bright ideas ? Thanks very much.
Asked in: Suse-Linux-Servers  (5 answers)
s's response: I would start with making sure the console goes to a serial port (add console=ttyS0,115200n8 console=tty0 to the kernel parameters in your boot loader configuration, optionally also add a getty on that serial port in /etc/inittab or equivalent on your distribution). Connect that to another server and connect a GNU screen window to that (in screen :screen /dev/ttyS0 115200,cs8), log that window (H). Also make sure none of the sysrq keys are disabled:
echo kernel.sysrq=511 > /etc/sysctl.d/sysrq.conf
That way, you'll have a chance to see kernel panics or oopses if any and run sysrq-t and the like to get a chance to see where it's stuck. Look for firmware upgrades for BIOS, network adapters, disk controllers... on your server.
I have a new way of logging Apache hits in tandem with existing logs that will grow far more rapidly than those already set up. Can I just copy logrotate files for other daemons ? Do I have to start and stop anything ? Thanks.
Asked in: Linux-Servers  (3 answers)
s's response: Yes, you can copy and edit/adapt conf files. Those conf files are only read when logrotate is started by a cronjob at night. You don't need to restart anything.
My netcat (nc) doesn't listen! It means when I write nc -l 3333, I can't communicate data with nc 127.0.0.1 3333 in another terminal! Also after writing nc -l 333, I don't see port 333 between the ports which are listening, by netstat -ln | grep 3333. What should I do? Thank you!
Asked in: Linux-Servers  (9 answers)
s's response: port 333 is under 1024 so priviledged. You should have seen an error message when running nc -l 333. Anyway, "nc" is a crap software with many different implementations trying to fix many of the bugs of the original version (which was admittedly created by a student to learn about network programming). You could consider socat instead: socat tcp-listen:3333,reuseaddr - would probably be the equivalent of nc -l 3333 And socat - tcp:127.1:3333 the equivalent of nc localhost 3333
I'm using this command at the moment: find . -size +500000 -print but it isn't very refined. How else can I track down large files on my filesystem ?
Asked in: ShellScripts  (4 answers)
s's response:
find . -printf '%s\t%p\n' | sort -rn | head -30
Will give the 30 largest files, it won't necessarily report the ones that take up the most space on disk though. Use %k instead of %s for disk usage (in kb) instead of file size. That assumes GNU find as -printf is GNU specific. With zsh:
ls -ldU -- **/*(DOL[1,30])
Sometimes dmesg gets full of junk and I want to add something to the end. I know logger works with syslog but what about writing to dmesg so the last few entries are no longer junk ? Thanks in advance for any help.
Asked in: ShellScripts  (5 answers)
s's response: You could use this trick: mount -o 'remount, some comment here ' / (yes there's a newline after "," and before "'") Then, you'll get [193337.614978] EXT4-fs (dm-0): Unrecognized mount option " [193337.614980] some comment here [193337.614981] " or missing value
I need to delete all files that end .gif and somewhere in the name have "RFJ". There are hundreds of other files and some also have RFJ in their name. There's loads of subdirectories too. I can't risk deleting live image files because it's a web server and a restore from the backups will take time. Any help would save me a heap of trouble !
Asked in: ShellScripts  (4 answers)
s's response: With GNU find: find /path -name '*RFJ*.gif' -delete
Can I just download a patch then apply it to package file and then run apt-get install to install it ? How does it work ? Thanks.
Asked in: Linux-Servers  (3 answers)
s's response: You'd do: apt-get source the-package Add the patch to debian/patches, update debian/patches/series Run dch to give a new version number to your package build using dpkg-buildpackage Then, you'd obtain a .deb which you can install with dpkg
I need to view a remote console over HTTP with javascript enabled. Is it possible ? Thanks.
Asked in: Linux-Servers  (1 answers)
s's response: elinks has some level of support for javascript (using firefox engine) but you may have to compile it yourself as versions shipped with some distributions don't have it enabled.
Can I backup the master boot record before I mess around with fdisk ? Any warnings I should watch out for ?
Asked in: Linux-Servers  (2 answers)
s's response: dd count=1 < /dev/sda > sda.mbr to restore: cp sda.mbr /dev/sda
Is there a simple tool to backup a whole partition or drive of a server ? The server must still be running. I don't want to fiddle with dangerous dd or rsync commands but can use a command line rather than a GUI if needed. I need it to be simple so I don't write over a live server drive ! It's important the backup and restore can be done without a reboot. Thank you.
Asked in: Linux-Servers  (2 answers)
s's response: Your question doesn't make sense. You can't do a consistent image of a block device if something is writing to it. You can't change the content of (restore) a block device under the system or application feet without causing havoc. What you can do if using LVM is make a snapshot of a volume and then copy it elsewhere. That can be done live. But for restoring, that can't be done live. If the system is virtual and the file system used is xfs. You can do xfs_freeze on the guest and then take a snapshot of the virtual disk on the host to have the disk and the filesystems on it on a consistent state (you may also want to tell some applications like RDMs to make sure their files on disk are in a consistent state). But again, you can't restore live the disk. You can also work at file level using rsync or tar/pax/cpio... on the snapshots. You can restore live (with rsync), but that may still cause havoc if restoring files under applications feet. That can be limited if you stop those applications (think for instance RDBMs) before doing the snapshot and before doing the restore.
I need to flag a warning if a text file, with loads of information in it, has IP address duplicates in it and roughly where in the script they occur. The IPs are all in the format 100.100.100.100. Could I use uniq and sort ? Any takes ? I'll happily pass on fifty of my points and the best answer points.
Asked in: ShellScripts  (2 answers)
s's response: You could use uniq and sort like in: grep -Eo '([0-9]+.){3}[0-9]+' < /etc/hosts | sort | uniq -c | awk '$1>1' | sort -rn But that wouldn't tell you where they are. This should: http://pastie.org/2134767
I'm looking at doing some basic IDS stuff with IPtables from: http://netfilter.org Can someone point me at some useful examples please for matching packets with a string ? Cheers.
Asked in: Server-Firewalls  (3 answers)
s's response: sudo iptables -D INPUT -m string --string servercircle -j LOG --algo bm --log-prefix SERVERCIRCLE You'd think that'd log your browsing to servercircle. Not if compression is enabled (see Content-Encoding: gzip in the HTTP headers).
I have this file with this format: AAA 777 KKK and then another with this format: AAA KKK 777 Can I merge them somehow with some Linux magic ? There's thousands of entries in each so I just want to makes the second file in the same format so I can merge them. Thank you !!
Asked in: ShellScripts  (1 answers)
s's response: Look at the join(1) command (note that the files need to be sorted by the joining column). ( export LC_ALL=C join -1 2 -2 2 <(sort -k2,2 file1) <(sort -k2,2 file2) ) to join on 2nd column for instance.
Is this possible on Linux ? When I use ifconfig it always needs the network interface brought down and then up again. I'd like to change the MAC address without resetting it.
Asked in: Linux-Servers  (2 answers)
s's response: Have you tried this ? ip link set address xxx dev yyy
I get a summary of recursive file sizes with: du -h and get a summary of current directory file sizes with: du -h * Why ? Thanks.
Asked in: ShellScripts  (3 answers)
s's response: What do you mean? du -h and du -h . are the same. When you use: du -h * the shell expands * to the list of files and directories (except those whose name starts with a dot) in the current directory. du won't report disk usage of non-directory unless they are explicitly passed as arguments. Or you can use the "-a" option.
Can I easily set one up on our LAN to stop lots of downloads from outside the LAN ? It should save bandwidth a bit.
Asked in: Debian-Linux-Servers  (2 answers)
s's response: You could try one of those: $ apt-cache search proxy '\bapt\b' approx - caching proxy server for Debian archive files apt-cacher - Caching proxy for Debian package and source files apt-cacher-ng - caching proxy server for software repositories apt-p2p - apt helper for peer-to-peer downloads of Debian packages debtorrent - bittorrent proxy for downloading Debian packages
This is failing for some reason - all I want is working regex for a valid email address in any PHP function that works ! if (preg_match('/^([a-z0-9_-]+)(\.[a-z0-9_-]+)*@([-a-z0-9]+\.?)+\.[a-z]{2,4}$/i', $email)) { execute ... } Mmm. Any ideas ? Thanks.
Asked in: OtherProgramming  (2 answers)
s's response: http://www.linuxjournal.com/article/9585?page=0,3
I'd like to add an IP address to /etc/hosts.allow under some circumstances inside a shell script and I'd like to also have a command executed if an untrusted IP address then tried to connect to a specific TCP port via TCP wrappers. I can't go into too much detail for security reasons but is this scenario possible ? If so how ? I'd be grateful for any help.
Asked in: Ubuntu-Linux-Servers  (1 answers)
s's response: Yes. See host_access(5).
I'm writing an essay and would like to know how it's categorized please. Many thanks.
Asked in: Linux-Servers  (2 answers)
s's response: It becomes a server when you intend it to be, that is when it is meant to serve something to someone else. Though it might still stay a desktop if you're using it as your workstation. There's no reason why one machine can't be both.
How can Ubuntu suddenly want to make my default shell Dash and not Bash ? I don't understand why it's asking me that question during a package install and why they have moved away from Bash. Thank you.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: I think you mean default /bin/sh. Ubuntu moved over to dash for /bin/sh a long time ago. Though you still have the option to move back to bash in case you have some broken /bin/sh scripts that rely on some non-POSIX features. Bash is probably the worst shell around in terms of performance, so it's a bad choice for interpreting scripts. Shells based on pdksh or dash are usually a lot faster. It's also very poor in terms of interactive features when compared to zsh or tcsh. The main reason why bash is so universal is because it is the shell of the GNU project.
I get these errors a lot in my mail logs and I've added the authority to the system: certificate verification failed for gmail-smtp-in.l.google.com untrusted issuer /C=US/O=Equifax/OU=Equifax Secure Certificate Authority I've also tried numerous other suggestions. Any managed to solve it on Postfix ?
Asked in: Debian-Linux-Servers  (1 answers)
s's response: Make sure postfix's smtp_tls_CApath points to the list of trusted CAs. On a debian based systems, that would be /etc/ssl/certs and you choose which CA to trust with sudo dpkg-reconfigure ca-certificates
Can I print out a simple directory tree for reference on the command line in Ubuntu Server ? Is there such a command ?
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: Look at the "tree" package and command.
I thought I should add a line to my .bashrc file in my home directory. export PS1='\e[1;32m[\u@\h: \W \t]\$ \e[m' Text is bizarrely over-running each single line now and then the text just overwrites the current line. I know I can just remove it but why is that happening ? Thank you.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: Bash gets confused because e[1,32m although 7 characters has zero width when displayed. You've got to tell it that by using [, ] to enclose the zero-width parts see the manual for details.
Which RSS feeds or mailing lists should I be subscribed to for keeping an eye out for Ubuntu security updates and other problems with specific Ubuntu server ? Thank you for your guidance.
Asked in: Ubuntu-Linux-Servers  (5 answers)
s's response: Sorry, my bad, I meant the mailing list ubuntu-security-announce@lists.ubuntu.com See https://lists.ubuntu.com/mailman/listinfo/ubuntu-security-announce for how to subscribe. See also http://www.ubuntu.com/usn and http://www.ubuntu.com/usn/rss.xml
How do a run safe script (that won't go into a loop and cause problems) continually to check another server's downtime remotely ?
Asked in: Linux-Servers  (1 answers)
s's response: ping www.google.com | perl -lne 'utime undef,undef,"some-file" if /bytes from/' would update the last modification and access time of "some-file" every time you get an answer from ping to the address. So the age of the file will give you how long the server has been down for. You may want to consider using the -i option of ping, to ping less often than every second.
How can I tell how long my old DNS record will be cached for ? I moved the www entry to a new IP but lots of people still see the old record.
Asked in: DNS-Servers  (1 answers)
s's response: $ dig +noall +answer www.servercircle.com www.servercircle.com. 300 IN A 194.36.163.64 That one can be cached up to 300 seconds. $ dig +noall +answer www.foxxy.com www.foxxy.com. 21600 IN A 66.37.28.236 That one 6 hours...
How do I change the language settings on Ubuntu Server ? Thank you.
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: On a per-process basis, use the LANG and/or LC_* environment variables. Globally, you can set the default locale by editing /etc/default/locale by hand or using update-locale. You can see the list of available locales with locale -a. You can compile more locales using locale-gen after having edited /etc/locale.gen
Is this quite easy ? I've never done it before in Linux. Cheers.
Asked in: Linux-Servers  (3 answers)
s's response: See taskset(1)
I'm looking for one that will work with Debian and Ubuntu Servers ideally. Where would I get one ? I'm in the UK.
Asked in: Debian-Linux-Servers  (4 answers)
s's response: USB2106S StarTech Compact USB 2.0 works fine and is cheap. based on MosChip MCS7830 Beware that some very cheap ones are USB 1 so won't achieve the full 100Mb/s speed
How do you go about making a cable to connect into a serial port of a device over the console ? I need to have console access to a switch from a server. One end is like ethernet (CATV) and the other is the grey serial type end. Cheers.
Asked in: Linux-Servers  (2 answers)
s's response: You could look for your switch at http://www.allpinouts.org/ ethernet end would be RJ45 and other end DB9, but pin assignment are likely to be different from one brand to the next.
I use hping like this: hping -i eth0 -c25 -S 123.123.123.123 -p 80 Is this creating a SYN packet correctly ?
Asked in: Server-Networking  (1 answers)
s's response: I would have said yes, but doing it myself and checking with wireshark (and comparing with the packet generated by telnet 123.123.123.123 80), it's not valid because it's got a non-zero ack field even though the ACK flag is not set. Adding -L 0 would probably make it correct.
I use "CTRL-A" then "d" to detach my session in screen before I log out but if I forget and the SSH session timeouts then screen -r doesn't work always. What am I doing wrong ? Is there another way to reattach the session ? Thanks.
Asked in: Linux-Servers  (2 answers)
s's response: screen -x attaches to a screen session even if it's already attached elsewhere.
Is there a tool to look up an IP address from a MAC address, I suppose it's in reverse to the normal way of doing it ? Cheers.
Asked in: Ubuntu-Linux-Servers  (1 answers)
s's response: I'll assume you're talking of IPv4 here. Note that one MAC address can have more than one IP addresses, not all of which may be on the same subnet as yours on the same link. You can use arping. That will not necessarily work. If you don't get any answer, you can always try with variations of the -0, -b, -T -s... options. If it might be a router, you can try and get it to send an ICMP unreachable (with a short TTL or to an unexisting address. Alternatively, you could query the switch if it's got a SNMP interface as it might have that information: snmptable -v2c -c public switch-address .iso.org.dod.internet.mgmt.mib-2.ip.ipNetToMediaTable
Is it possible to change a jpg to a png file on the Linux command line ? Sometimes I have to do this and it involves downloading the file and working with it on a desktop, then uploading it again. I'd like to be able to resize the width and the height of an image from the command line without a GUI too. Any packages that do this ?
Asked in: Linux-Servers  (3 answers)
s's response: With ImageMagick: convert -resize 100x100 file.jpg file.png With netpbm: jpegtopnm < file.jpg | pnmscape -h 100 -w 100 | pnmtopng > file.png
How would I write a script to process a few thousand IPs with their WHOIS records into a text file afterwards ?
Asked in: Linux-Servers  (3 answers)
s's response: Assuming the IP addresses are in a text file (newline or blank separated): xargs -n1 whois < list.txt > whois.txt
I've been told to cache images in the browser so there's less bandwidth used by our website. I thought web designers did this. Can you do it in Apache ? I've gone for Ubuntu Server now that LAMP is working !
Asked in: Ubuntu-Linux-Servers  (3 answers)
s's response: You can given hints to clients and proxies through the Cache-Control header. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 for details.
How do I only allow some IP Addresses access to my SSH Server on Ubuntu Server ? Thank you.
Asked in: Cloud-Servers  (2 answers)
s's response: That can be done at different levels: - firewall - pam (through pam_access) - tcpwrappers - sshd config - authorized_keys file If you do it at firewall level, then the sshd process won't even see the incoming connection, and you can hide the fact that there is a ssh server running. At pam level, you can enable pam_access in /etc/pam.d/sshd and configure access with /etc/security/access.conf In sshd_config, see AllowUsers, DenyUsers For tcp wrappers, see /etc/hosts.allow, /etc/hosts.deny And in the authorized_keys, you can restrict access per key with "from" parameters.
I'm looking for a lightweight script to generate as much UDP traffic as possible on my server's 100Mbit connection for penetration testing. Any recommends ? Thanks.
Asked in: Server-Networking  (2 answers)
s's response: You can look at iperf. See also socat in combination with pv for instance.
I can't get tcpdump to stop sniffing the network after a certain number of packets. The man page says it's possible but the syntax is obviously tricky. It's Debian if you need to know. Can anyone else tell me please ?
Asked in: Debian-Linux-Servers  (2 answers)
s's response: What did you try? tcpdump -i eth0 -c seems to work for me.
I'm pretty new to writing shell scripts in Bash. My scenario is: Every time "counter" is present in a text file I need to add a line "The count was present with a total of $counter". What's the best tool to use in Bash ? I could use "grep" to find the occurrence but then how would I increment $counter and append a line straight after "counter" ? Thanks.
Asked in: ShellScripts  (4 answers)
s's response: Not sure what you mean, would this do? perl -lne 'print; print "The count was present with a total of " . ++$counter if /counter/'
Are there any security reasons why ssh_config should only be readable by root. I think it's safer to keep details about key services like SSH private from local users (by tightening up sshd_config) but is the SSH config file "important" ?
Asked in: RedHat-Linux-Servers  (2 answers)
s's response: ssh_config should be readable by everyone as it's the default configuration for "ssh" used by everyone. sshd_config can be made readable only by root if you don't want users to know how it is setup or if there's sensitive information in there (there wouldn't be by default)
Is there a way of seeing the changelog file before upgrading a package on Debian or Ubuntu ? I see to have to upgrade first and download the package and install it and then I can see the changelog.
Asked in: Debian-Linux-Servers  (1 answers)
s's response: sudo dpkg-reconfigure apt-listchanges
How do I find out which packages support TCP wrappers ? I know SSH does but what about others ? Thanks in advance.
Asked in: RedHat-Linux-Servers  (6 answers)
s's response: ldd "$(command -v sshd)" | grep libwrap would check if sshd links against libwrap from the TCP wrappers
Should I upgrade from Lenny now (oldstable) to Squeeze ? I know it says oldstable is available for security upgrades for a while but how long in reality is that ?
Asked in: Debian-Linux-Servers  (4 answers)
s's response: http://www.debian.org/security/faq#lifespan you've got a year to switch at most.
Is there always a variable in a PHP script for fonts being pushed into something like a PDF converter or is it set "globally" ? How can I change it ?
Asked in: OtherProgramming  (2 answers)
s's response: php doesn't know anything about fonts. If you have some software written in php or any other language that generates PDF, please refer to that software documentation to see how to specify the font to use.
I need to know if there's too much noise on a subnet so I'd like to automate a way of telling me how many broadcast and multicast pps (packets per second) are on a subnet. I can't figure out a good way of doing it though. I'm keen to keep my hard earned points so I'll happily give a £10 Amazon Voucher to the Best Answer (the voucher can be towards your preferred Amazon site: .com, .fr, .de or .co.uk etc).
Asked in: Server-Networking  (6 answers)
s's response: I just noticed that not all versions of netstat on Linux give the same information (for instance squeeze's doesn't give you the multicast statistics). You can also get the information directly from /proc (/proc/net/snmp, /proc/net/netstat, /proc/net/snmp6). You can also install a snmp agent on the server to be able to query that information remotely (and locally as well). snmptable -v2c -c <community> <hostname> .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable snmptable -v2c -c <community> <hostname> .iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable
I'm new to these. How do they work, if I serve it from PHP for example ? Thanks for any assistance you can provide me.
Asked in: ShellScripts  (3 answers)
s's response: A RSS feed is just an xml file that clients pull from time to time. See this site's one as an example of what it looks like: http://www.servercircle.com/xrss.php (save it as a file and open with a text or xml editor). See for instance http://www.ibm.com/developerworks/xml/library/x-phprss/index.html for more information and code to generate RSS data.
Has anyone done this before ? How does it work ? Can I simply run the absolutely essential read/write directories from RAM, like /proc etc ? You can probably tell I'm a newbie when it comes to this :-) --EDIT-- This is for a Debian Server and I'd like the FS read-only so that it's more secure.
Asked in: Linux-Servers  (1 answers)
s's response: You can make your life easier by using a union mount using aufs or unionfs-fuse. Basically, you make one FS (U) out of several ones that are /unioned/ together. In your case, 2 FS, one read-only (like a on a cloop or compressed btrfs on your usb tick (R) ) and one writable in RAM (tmpfs typically) (W). When you write on U, it create a file on W and writes to it. When you read from U, it reads from R unless the file was created on W.
I've tried lots of things but can't get this to load with my .bash_aliases. It used to work. Ideas appreciated.
Asked in: Ubuntu-Linux-Servers  (2 answers)
s's response: .bash_profile is the file interpreted by bash upon login (so in theory only for one shell instance in your whole login session). That's not the best place to put alias definitions that are not inherited by new shells. In your .bash_profile, you'll put things that are meant to be set only once, like environment variable definitions, login specific stuff... alias definitions should go in the interactive shell customisation file: .bashrc that is interpreted by every interactive shell. However, bash has a bug/misfeature in that login shells, even interactive ones don't read the .bashrc (it also has another bug in that some non-interactive shells read the .bashrc). To work around that, you generally add to your .bash_profile: case $- in (*i*) [ ! -f ~/.bashrc ] || . ~/.bashrc esac Doing the other way round as suggested here is definitely wrong. Alternatively, you could use zsh which is a much better shell.
I'm having trouble working out if my disks are slow. free -m and top show little problems. How can I check IO ?
Asked in: Linux-Servers  (2 answers)
s's response: See also iotop, dstat, iostat, /proc/diskstats. Check dmesg output in case of IO problems. You could check the smart status with smarctl -a. What usage scenario, what file system type? RAID? LVM? snapshots? What makes you think it's slow? See /proc/sys/vm/block_dump to check which process is doing what block IO. You can use hdparm -t/-T to do some basic senquential r/w benchmark, bonnie++ for more extensive ones.
I use lsof -i to look up which ports are open and to which application but I'd like more information on the application/daemon opening the port. Any ideas ?
Asked in: Linux-Servers  (2 answers)
s's response: What kind of information? What operating system are you using? Once you have the process ID, you can get all sorts of information with ps -p, lsof -p, strace/tusc/truss, /proc/...
About Us : Contact Us : Etiquette : Terms : CDN Failover : ShorterURL : CDN Fallback : © 2013 Server Circle