Tuesday, June 14, 2011

sudo -l not working

sudo -l is a substiitute for profile -l in Solaris.

sudo -l  just prints the commands for which the user has permission to run.

The general way to do it is:

su to the corresponding user and type sudo -l

su user

It will print all the commands the user has perminission to run.

sudo -l   username 
will not work in Linux though profile -l username works for Solaris.

If you get error that the user is not in sudoers or permission denied.

Then it says this particular user is not in the /etc/sudoers.
Check whether  user is present  in any of USER_ALIAS in the /etc/sudoers .
If not add the user to a  appropriate group(USER_ALIAS) in the sudoers file.

For immediate requirement you can also find the  command list by manually tracing  through  the /etc/sudoers file for the user.


netstat getnameinfo failed error

netstat -pt shows getname info failed error when u try to grep something from the output.

the error is due to one of the IP's in the netstat output cannot be converted into hostname as it does not exist in the /etc/hosts instead it is getting converted to UNKNOWN.

You avert the error by using


1) netstat -pt --numeric_ports  | grep something
when you use this command the IP's will not  be converted into hostnames and the error will not arise.

2)or try to find for which IP's the hostname is not generated and in the netstat  output it shows as UNKNOWN and try to add those IP's to the /etc/hosts.
And in some cases it may also be tunnel IP's which is unknown to the system and it will be of different format.