Browsing articles tagged with "linux - 2/777 - Admins Goodies"
Feb 16, 2013
tom

find command from PID

Is it possible to find the command line of a running process with its pid? the output of /proc/pid/cmdline seems that it removes the space character to it is hard to read the output. Asked by mahmood From: http://stackoverflow.com/questions/993452/splitting-proc-cmdline-arguments-with-spaces cat /proc/PID/cmdline | tr ’00′ ‘ ‘ cat /proc/PID/cmdline | xargs -0 echo Answered by Jay Check more discussion of this question. Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with [...]

Continue Reading »
Feb 15, 2013
tom

Allow complex sudo command on Debian Linux

I need to allow a specific command on a Debian Linux box for a single user. I’ve tried this in the /etc/sudoers file: # User privilege specification zabbix ALL=NOPASSWD: /usr/bin/apt-get –print-uris -qq -y upgrade 2>/dev/null |awk ‘{print $2}’ | wc | awk ‘{print $1}’ This does not work as expected. If I run the command as user zabbix with sudo, it asks for the password (although I have specified the NOPASSWD option). However, this works: [...]

Continue Reading »
Feb 14, 2013
tom

Linux: Allow complex sudo command

I need to allow a specific command on a Debian Linux box for a single user. I’ve tried this in the /etc/sudoers file: # User privilege specification zabbix ALL=NOPASSWD: /usr/bin/apt-get –print-uris -qq -y upgrade 2>/dev/null |awk ‘{print $2}’ | wc | awk ‘{print $1}’ This does not work as expected. If I run the command as user zabbix with sudo, it asks for the password (although I have specified the NOPASSWD option. However, this works: [...]

Continue Reading »
Feb 8, 2013
tom

Save file after forgetting to open as root / sudo vi [duplicate]

Possible Duplicate: vim re-edit as root I could have sworn I saw this question asked. But after looking though every search result for “vi” I’m stumped/lazy. I’ve opened a file, made an edit and now I realize it’s read only and I’ve opened it as non-root me. Asked by MathewC I think you want something like this: :w !sudo tee “%” I first saw it on commandlinefu. The quotes are only necessary if the file [...]

Continue Reading »
Feb 3, 2013
tom

Adding a timestamp to bash script log

I have a constantly running script that I output to a log file: script.sh >> /var/log/logfile I’d like to add a timestamp before each line that is appended to the log. Like: Sat Sep 10 21:33:06 UTC 2011 The server has booted up. Hmmph. Is there any jujitsu I can use? Asked by Antonius Bloch You can pipe the script’s output through a loop that prefixes the current date and time: ./script.sh | while IFS= [...]

Continue Reading »
Jan 25, 2013
tom

Static route without knowing the nexthop (linux)

I have an eth3 interface in a linux router, with an adsl modem. This adsl modem is in bridged mode, so the public IP is assigned to eth3 (say 11.22.33.44), and the modem is just not seen by my server. I want to define a static route to a specific IP (88.191.250.176) through eth3, but I don’t have a nexthop to set: ip route add 88.191.250.176 dev eth3 is accepted but does not work (packets [...]

Continue Reading »
Jan 24, 2013
tom

Doing backup from Linux to USB Pen Drive with rsync

I am trying to do a backup from Linux to USB Pen Drive with rsync each day and I take home the Pen Drive at night. I am running the following command but it looks like its update every file every day? rsync -y -r -vv ~/Documents/ /media/PenDrive/xxxx-home/ Can someone please tell me if this can be done better I used to just tar of my ~/Documents and cp the file to my Pen Drive [...]

Continue Reading »
Jan 23, 2013
tom

Ordinary users are able to read /etc/passwd, is this a security hole?

ls -l /etc/passwd gives $ ls -l /etc/passwd -rw-r–r– 1 root root 1862 2011-06-15 21:59 /etc/passwd So an ordinary user can read the file. Is this a security hole? Asked by abc Actual password hashes are stored in /etc/shadow, which is not readable by regular users. /etc/passwd holds other information about user ids and shells that must be readable by all users for the system to function. Answered by Michael Check more discussion of this [...]

Continue Reading »
Jan 23, 2013
tom

Adding Additional RAID Array to Ubuntu 11.10 x64 Server

I asked this on askubuntu.com as well but since it’s a server question, figured I’d throw it on SF, too. Haven’t run into this situation before but it seems simple enough. Looking for advice/guidance on the following issue. I have an Ubuntu 11.10 64-bit server that is configured with 2 identical hard drives in a RAID-1 through the mdadm utility. It’s a simple LAMP server that runs a few projects I’m working on but is [...]

Continue Reading »
Jan 22, 2013
tom

Serving static directory on subdomain with assets

I have a html presentation which I would like to serve on a subdomain on my server. It just consists of some static html files and some assets (the Github is here). I’m trying to write an nginx config file which will serve the presentation. What I have so far is the following: server { server_name make-js-like-ruby.grinnick.com; root /home/dtuite/stuff/presentations/make_js_like_ruby/introduction; access_log off; error_log off; } The actual root file is in /introduction/index.html. Nginx seems to serve [...]

Continue Reading »
Pages:«1234567...777»