Archive for Linux

Where is root? or how to enable root login in Ubuntu

Ubuntu developers made a conscientious decision to disable the administrative root account by default
Sudo allows an authorized user to temporarily elevate their privileges
using their own password instead of having to know the password belonging to the root account.
This simple yet effective methodology provides accountability for all user actions, and gives the
administrator granular control over which actions a user can perform with said privileges.
• If for some reason you wish to enable the root account, simply give it a password:
sudo passwd
Sudo will prompt you for your password, and then ask you to supply a new password for root as
shown below:
[sudo] password for username: (enter your own password)
Enter new UNIX password: (enter a new password for root)
Retype new UNIX password: (repeat new password for root)
passwd: password updated successfully
• To disable the root account, use the following passwd syntax:
sudo passwd -l root
• You should read more on Sudo by checking out it’s man page:
man sudo
By default, the initial user created by the Ubuntu installer is a member of the group “admin” which is
added to the file /etc/sudoers as an authorized sudo user. If you wish to give any other account full
root access through sudo, simply add them to the admin group.

Unable to find network card in CentOS 6

Some time we are unable to find network information on ifcfg command or network connection does not work after cloning.

To see all interfaces   ifcfg -a

To force CentOS 6 to re-detect network interfaces

Delete the MAC Address from ifcfg-eth0 file

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Remove the old 70-persistnet-net.rules file with the following command

rm -f /etc/udev/rules.d/70-persistent-net.rules

Reboot the machine.



How to add remove enable disable services on start up in Cent OS

To manage services in Cent OS in Text User Interface (TUI)
# ntsysv
if you do not have “ntsysv” command  # yum install ntsysv
its shows TUI  interface to enable and disable the services in CentOS.
from CLI we use chkconfig 
For example i am taking service name “test”
Add service called test
# chkconfig –add test
Delete service called test
# chkconfig –del test
List status for test service
# chkconfig –list test
Turn on or off services:
# chkconfig test on
# chkconfig test off
# chkconfig –level 2 test on       (to Start service on Runlavel 2)
# chkconfig –level 35 test on      (to Start service on Runlavel 35)

how to run multiple command on single line on CentOS

If you want to run multiple command on single line on CentOS.

If you want to execute each command only if the previous one succeeded, then combine them using the  “&&" operator. If one of the commands fails, then all other commands following it won’t be executed.

Example :-cd /my_folder && rpm -ivh  *.rpm && rm -rf *.rpm && service mysql status

If you want to execute all commands regardless of whether the previous ones failed or not, separate them with semicolons “;”

Example:-cd /my_folder; rm *.jar; svn co path to repo; mvn compile package install


How to install FTP server on CentOS

#yum install vsftpd
#chkconfig vsftpd on
#service vsftpd start

#nano /etc/vsftpd/vsftpd.conf       (uncomment the following)

anonymous_enable=NO   (disallow anonymous login)
ftpd_banner=Welcome to DATACENTER FTP service.

If users are not able to create direcroy in their folders users are getting error  550 Create directory operation failed

Run following command

#setsebool -P ftp_home_dir=1


Commonly used Linux important Commands

get list of all installed software

rpm -qa | less

Use following syntax to list the files for already INSTALLED package:

rpm -ql package-name for example :- rpm -ql package

rpm -ql package-name

Type the following command to list the files from rpm package:

rpm -qlp packege.rpm

Remove the rpm packege

rpm -e packege name

Search installed packege

rpm -qa packege name

upgrade the packege

rpm -Uvh packegname.rpm

force fully upgrade the packege

rpm -Uvh –force packege name.rpm