Quote:
/etc/sudoers file mentions this file MUST be edited by running visudo?? Well I have edited with vi /etc/sudoers & visudo with the same result. Does it REALLY matter how I edit it??
|
It does not matter as long as the editor uses UNIX line breaks and not MS linebreaks. Any Linux editor *should* be fine.
Quote:
Oh afer every edit of sudoers I run 'source .bashrc'
|
First of all, it's 'source ~/.bashrc' and this is only necessary if you added aliases in a script located in your home directory called '.bashrc' (the ~ char is a shortcut to your home directory).
maybe these examples will help:
/etc/sudoers:
Code:
#drkstr is a member of the users group
%users ALL=/sbin/mount,/sbin/umount
drkstr ALL=NOPASSWD: /sbin/fdisk, /sbin/init
Code:
drkstr@dsk:~$ sudo fdisk -l
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:
drkstr@dsk:~$
oops, got a password.
Code:
drkstr@dsk:~$ sudo /sbin/fdisk -l
Disk /dev/hdb: 40.9 GB, 40982151168 bytes
255 heads, 63 sectors/track, 4982 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 4255 34178256 83 Linux
/dev/hdb2 4256 4982 5839627+ 83 Linux
drkstr@dsk:~$
no password here though.
so let's create an alias:
Code:
#!/bin/bash
# /home/drkstr/.bashrc
#note: '.' is a shortcut for 'source'. the following line is optional, but I recommended it.
. /etc/profile
alias fdisk='sudo /sbin/fdisk'
Code:
drkstr@dsk:~$ fdisk -l
-bash: fdisk: command not found
drkstr@dsk:~$
oops, I forgot to import my new alias into my current shell
Code:
drkstr@dsk:~$ source ~/.bashrc
drkstr@dsk:~$ fdisk -l
Disk /dev/hdb: 40.9 GB, 40982151168 bytes
255 heads, 63 sectors/track, 4982 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 4255 34178256 83 Linux
/dev/hdb2 4256 4982 5839627+ 83 Linux
drkstr@dsk:~$
It works, yipee!
Hope this was some help, let me know if there is anything else that needs some more explaining.
best regards,
...drkstr