Linux System Administration

What if you want one user to run a command as an another system user without exchanging passwords. For example, you may want an user john to run a find command or custom bash shell script as an user greg or even as a user root ( superuser ) without password exchange. In this case a sudo utility with its /etc/sudoers configuration file will be your friend. This utility is very widely used but at the same time very little understood by Linux users of all levels.

This short article describes some basic of sudo usage and format of sudoers configuration file.

sudo install

First we need to make sure that sudo and /etc/sudoers the sudo configuration file is available. To do that run:

$ which sudo

or

$ sudo -V

The first command should reveal a location of a sudo binary executable and the second program will output a version number of sudo command its self. The sudo configuration file sudoers is in most cases located in /etc/sudoers. You can use ls command to locate this file.

$ ls -l /etc/sudoers
-r--r----- 1 root root 481 2010-04-08 21:43 /etc/sudoers
Read more ...

rsync can be used in many ways. This small utility got its name from Remote Synchronization words. However the word remote does no have to be a remote location over the network. rsync can be also used to synchronize your camera photos with your PC's hard drive. No fancy MS windows synchornizator tools which came with your camera are nedded. Here are simple steps how to sychronize:

first find you USB device name:

# fdisk -l
# mount your USB:
# mkdir /media/camera
# mount /dev/sdb1 /media/camera/

create local directory for your photos:

$ mkdir ~/photos

synchronize your photos:

$ rsync -av /media/camera/ ~/photos

All done. Next time when you make some new pictures just repeat the the following:

# fdisk -l
# mount /dev/sdb1 /media/camera/
$ rsync -av /media/camera/ ~/photos

at this point rsync will copy only new images. This is also good way to keep a backup of you images.

OPTIONS SUMMARY:

-a, --archive archive mode

-v, --verbose increase verbosity

If you own a Thecus 2100 NAS storage and you need to recover from some software accident you have two options. One is to use a USB serial connector or use telnet to stop booting sequence of Redboot loader. Here is how to do the second, easier option.

What you will need is:

  • PC or laptop with Ethernet card
  • your PC will preferably a running linux ( in my case I have Debian )
  • CAT5/6 Ethernet cable

Note:You need to have a Thecus Firmware version =< 2.1.05 . In my case I had 2.1.10 and it all worked perfectly.

To star first install iputils-arping and telnet packages on your PC / laptop:

# apt-get install iputils-arping telnet

Connect your PC with an Ethernet cable to your Thecus box to INTERFACE 1. Set your PC's ip address to 192.168.1.101. Let's assume that your PC's Ethernet card connected to Thecus 2100 is eth0:

# ifconfig eth0 192.168.1.101

Redboot sets its default IP address on Thecus 2100 to 192.168.1.100 so that is the reason we had set our PS's IP address on tha same subnet. All what needs to be done now is to execute a following command on your PC:

arping -f 192.168.1.100 && telnet 192.168.1.100 9000

Now just simply reboot or power on your Thecus N2100 and wait. Once you see a screen similar to the one below enter CTRL+C to abort execution of a boot script.

WARNING: interface is ignored: Operation not permitted
ARPING 192.168.1.100 from 192.168.1.101 eth0
Unicast reply from 192.168.1.100 [00:14:FD:30:16:4E]  11.605ms
Sent 16 probes (16 broadcast(s))
Received 1 response(s)
Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.
== Executing boot script in 2.920 seconds - enter ^C to abort
^C^C
RedBoot> 

Page 62 of 72



Free Linux eBooks

Go to top