Archive for February, 2012

How to reset Red Hat Enterprise Linux 5 server root password

February 14th, 2012 by @HKw@! | No Comments | Filed in Linux, RedHat

One of our customer forgot his Red Hat Enterprise Linux 5 server root password. He request us to reset his root password. Below are the few simple steps that i did to reset the root password.

  • First thing i have to do is to reboot the server and enter to the single user mode. Once you reboot the server and wait until the GRUB menu screen come out.Select the desired kernel you want.
  • Press the ‘e‘ key to edit that entry.
  • Use the arrow keys to navigate to the kernel line (for example: kernel /vmlinuz-2.6.x-x ro root=LABEL=/ rhgb quite)
  • Add the argument ‘single‘ to the end of the line and then press ENTER. (for example: kernel /vmlinuz-2.6.x-x ro root=LABEL=/ rhgb quite single)
  • Press the ‘b‘ key to boot in to single user mode.
  • You will then be presented with a shell prompt similar to the following:

                           sh-2.05#

  • To change the root password, just  type passwd root
  • You just enter the new password twice
  •  After change the password, you just reboot your server.
  • Now you should be able to login to your RedHat Enterprise Linux server with the new root password.

 

 

 

 

Share

Useful Commands in Ubuntu

February 11th, 2012 by @HKw@! | No Comments | Filed in Linux, Ubuntu

Below are the list of commands needed when using Ubuntu:

Command privileges.

sudo command – run command as root
sudo su – root shell open
sudo su user – open shell as a user
sudo -k – forget your password sudo
gksudo command – sudo visual dialog (GNOME)
kdesudo command – sudo visual dialog (KDE)
sudo visudo – edit / etc / sudoers
gksudo nautilus – root file manager (GNOME)
kdesudo konqueror – root file manager (KDE)
passwd – change your password

Command Network

ifconfig – displays information network
iwconfig – displays information from wireless
sudo iwlist scan – scan wireless networks
sudo /etc/init.d/networking restart – reset the network
(file) /etc/network/interfaces – manual configuration
ifup interface – bring online interface
ifdown interface – disable interface

Commands Display

sudo /etc/init.d/gdm restart – reset X (Gnome)
sudo /etc/init.d/kdm restart – reset X (KDE)
(file) /etc/X11/xorg.conf – show Configuration
sudo dpkg-reconfigure – reconfigure xserver-xorg-phigh – reset configuration X
Ctrl+Alt+Bksp – X display reset if frozen
Ctrl+Alt+FN – switch to tty N
Ctrl+Alt+F7 – switch back to X display

Commands for Service

start service – service to start work (Upstart)
stop service – service to stop working (Upstart)
status service – check if service is running (Upstart)
/etc/init.d/service start – start service (SysV)
/etc/init.d/service stop – stop service (SysV)
/etc/init.d/service status – check service (SysV)
/etc/init.d/service restart – reset service (SysV)
runlevel – get current runlevel

Commands for Firewall.

ufw enable – turn on the firewall
ufw disable – turn off the firewall
ufw default allow – allow all connections by default
ufw default deny – drop all connections by default
ufw status – current rules and
ufw allow port – to allow traffic on port
ufw deny port – port block
ufw deny from ip – ip block


Command for get System information.

lsb_release -a – get the version of Ubuntu
uname -r – get kernel version
uname -a – get all the information kernel
df -h – displays filesystem disk space usage for all partitions (in Megabytes(M) & gigabytes(G))
free -m – displays the amount of free and used memory in the system in megabytes.
top – command displays information on your GNU/Linux system, running processes and system resources, including CPU, RAM & swap usage and total number of tasks being run.

Commands for Package Manager.

apt-get update – refresh updates available
apt-get upgrade – update all packages
apt-get dist-upgrade – version update
apt-get install pkg – installing pkg
apt-get remove pkg – uninstall pkg
apt-get autoremove – removing packages obsotletos
apt-get -f install – try to fix packages
dpkg –configure -a – try to fix a broken package
dpkg -i pkg.deb – install file pkg.deb
(file) /etc/apt/sources.list – list of repositories APT

Share
BlogCatalog