Showing posts with label RHEL. Show all posts
Showing posts with label RHEL. Show all posts

Friday, October 23, 2015

[RHEL]Recover Boot If fstab corrupt or Read Only File system Error [without boot from CD/DVD]

[RHEL`]Recover Boot If  fstab corrupt or Read Only File system Error [without boot from CD/DVD]

Dear Friends If you stuck problem in boot RHEL by wrong or corrupt entry in /etc/fstab and trick "single user  mode" not working cause of "Read Only FileSystem" Here is the solution
without using bootable media

Just follow these easy step.

Problem Happened cause :

 You are stuck at Recovery Mode (CTRL+D) and when you try to edit /etc/fstab its not done by :wq! option cause / is on readonly mode.

Then you  would try for "Single user mode". Its also not working then.. hmm what would you do now...

Solution ::

1. Reboot
2. On Boot Loader RHEL option "Press a" (this is for append that line on boot time)
3. add  init=/bin/bash  end of the line after a space. (to change shell)
4. then Enter or "press b" to boot it .
5. Now system will boot and will stop and Recovery Mode (CTRL+D)
6. just enter root password and you will get the # prompt.
7. Now run this command for mount / partition rw mode.
8. mount -o remount,rw /
9. now make changes in /etc/fstab and save and exit ,,, Reboot normally.
10. Your problem will be solved if follow set properly.


Thanks
 
 

Wednesday, May 8, 2013

Linux Which Command, Whatis Command, Whereis Command Examples

 

12 Linux Which Command, Whatis Command, Whereis Command Examples


This Linux tutorial will explain the three “W” commands. The three “W”s are whatis, whereis and which commands.

You already know how to use find command to efficiently fo find a file.
Now, these three W commands will help you to locate more stuff from Linux command line.

I. Linux whatis Command

Whatis command is helpful to get brief information about Linux commands or functions. Whatis command displays man page single line description for command that matches string passed as a command line argument to whatis command. Whatis command searches for string in its index databases which is maintained by mandb program. Whatis command picks short description of NAME section of man page of command that matches to input given to the whatis command.
Whatis provides several command line options to help user in getting brief information of specific Linux commands as per their need or interest.
Syntax:
$ whatis [-options]
For example, here is the output of whatis command, when it is run without any option.
$ whatis write
write (1)            - send a message to another user
write (2)            - write to a file descriptor
It displays brief information about “write” from man pages.

1. Get information from specific sections of man pages using -s option

If we want to get Linux command information from specific section of man pages, then we can provide sections list using “-s or —sections or –section” option. It will restrict whatis command to display brief information from specified man page section only.
$ whatis -s "1","2" open
open (1)             - start a program on a new virtual terminal (VT).
open (2)             - open and possibly create a file or device
It displays open command and function brief information from man page sections 1 and 2.
$ whatis -s "2" open
open (2)             - open and possibly create a file or device
It displays open function brief information from man page section 2.

2. Search information through wild-cards using -w option

If we want to search Linux commands or functions information using wild card, then whatis command gives “-w or –wildcard” option. It will make your search specific as per user’s need.
$ whatis -w 'ab*'
abort (3)            - cause abnormal process termination
abs (3)              - compute the absolute value of an integer
It displays brief information of Linux commands or functions which start from “ab”.
$ whatis -w 'ab?'
abs (3)              - compute the absolute value of an integer
It displays brief information of Linux commands or functions which start from “ab” and followed by any single character.

3. Search information through regular expressions using -r option

If we want to search Linux commands or functions information using regular expressions, then whatis command gives “-r or –regex” option. It will give flexibility to customize your search for Linux commands or functions throughout the Linux system.
$ whatis -r '^ab'
abort (3)            - cause abnormal process termination
abs (3)              - compute the absolute value of an integer
It displays brief information of Linux commands or functions which start from “ab”.
$ whatis -r 'ab$'
anacrontab (5)       - configuration file for anacron
baobab (1)           - A graphical tool to analyse disk usage
crontab (1)          - maintain crontab files for individual users (Vixie Cron)
crontab (5)          - tables for driving cron
fstab (5)            - static information about the filesystems
inittab (5)          - init daemon configuration
swab (3)             - swap adjacent bytes
tc-stab (8)          - Generic size table manipulations
It displays brief information of Linux commands or functions which ends with “ab”.

4. Disable trimmed output using -l option

Generally whatis command trims long output of Linux commands or functions information to avoid “Not good” output display on terminal that is going beyond screen. To allow whatis command to show complete output on screen, “-l or –long” option can be used.
$ whatis ssh-import-id
ssh-import-id (1)    - retrieve one or more public keys from a public keyserver (Launchpad.net by default) and append them to the current user's authorized_keys file (or some other specifie...
It displays trimmed output of brief information of Linux command.
$ whatis -l ssh-import-id
ssh-import-id (1)    - retrieve one or more public keys from a public keyserver (Launchpad.net by default) and append them to the current user's authorized_keys file (or some other specified file)
It displays complete output of brief information of Linux command.

5. Restrict search up to specified path using -M option

By default, whatis command uses $MANPATH environment variable. But whatis provides “-M or –manpath” option to restrict search up to specified path of man pages.
$ whatis -M /usr/share/man hexdump
hexdump (1)          - ASCII, decimal, hexadecimal, octal dump
It displays brief information of Linux hexdump command from man pages available at path /usr/share/man.
$ whatis -M /usr/man hexdump
hexdump: nothing appropriate.
It could not find brief information of Linux hexdump command from specified path /usr/man.

II. Linux whereis Command

Whereis command is helpful to locate binary, source and manual pages of commands in the Linux system. It is very simple utility and provides several options which are given below with examples.
Syntax:
$ whereis [-options]
For example, whereis command is run without any option.
$ whereis open
open: /bin/open /usr/share/man/man1/open.1.gz /usr/share/man/man2/open.2.gz
It locates binary, source and man pages of “open” command and here it displayed paths where binary, man pages of open command is available in the system.

6. Locate binaries using -b option

If we want to locate binary of Linux command, use “-b” option.
$ whereis -b whereis
whereis: /usr/bin/whereis /usr/bin/X11/whereis
It locates binary of “whereis” command and displays paths where binary of command is available in the system.

7. Locate man pages for a command using -m option

If we want to locate man page of Linux command, use “-m” option.
$ whereis -m whereis
whereis: /usr/share/man/man1/whereis.1.gz
It locates man page of “whereis” command and displays path where man page of command is available in the system.

8. Locate source of a command using -s option

If we want to locate source of Linux command, use “-s” option.
$ whereis -s whereis
whereis:
It locates source of “whereis” command, but source of “whereis” command does not exist in the system, so it did not display path for source of command in the system.

9. Locate unusual entries using -u option

This option is something different that searches for unusual entries. These entries are those command whose source, binary or man page does not exist in the system as per options “[-bms]” specified along with “–u”.
$ whereis  -m  -u wcgrep
wcgrep:
It checks if specified command (i.e. wcgrep) man page does not exist in the system. Whereis command with options “-m and -u” locates for the commands in the system whose man page does not exist.
$ whereis  -m  -u grep
$
Here, whereis command with same options is applied on “grep” command whose man page exists in the system, so whereis returned nothing and exits normally.

10. Locate binaries in a specified path using -B option

If user wants to search for binary and wants to limit the scope of search for whereis command up to specified path, then use “-B” option.
$ whereis -B /bin -f for_loop
for_loop: /bin/for_loop
It locates binary of “for_loop” user program from path “/bin”.
$ whereis -B /usr -f open
open: /usr/share/man/man1/open.1.gz /usr/share/man/man2/open.2.gz
If open command’s binary is not found at specified path, then it is not shown but whereis command by default searches for other types (i.e. man page and source) of specified command (i.e. open) and displays them if found.

11. Locate man pages with limited scope using -M option

If user wants to search for man pages and wants to limit the scope of search for whereis command up to specified path, then use “-M” option.
$ whereis -M /usr/share/man/man1 -f open
open: /bin/open /usr/share/man/man1/open.1.gz
$ whereis -M /usr/share/man/man2 -f open
open: /bin/open /usr/share/man/man2/open.2.gz
$ whereis -M /usr/share/man/man3 -f open
open: /bin/open
Here, it is observed that whereis command is displaying man page of “open” command which is available in specified path only. But, whereis command by default searches for other types (i.e. binary and source) of specified command (i.e. open) and displays them if found.

III. Linux which Command

Which command is very small and simple command to locate executables in the system. It allows user to pass several command names as arguments to get their paths in the system. “which” commands searches the path of executable in system paths set in $PATH environment variable.
Syntax:
$ which [-option]
For example,
$ which ls gdb open grep
/bin/ls
/usr/bin/gdb
/bin/open
/bin/grep
It locates command names – “ls”, “gdb”, “open” and “grep” specified as arguments to “which” command and displays paths of each executable where it exists in the system.

12. Display all the paths using -a option

“which” command gives option “-a” that displays all paths of executable matching to argument.
$ which echo
/usr/sbin/echo
Above will search display the executable “echo” from all paths set in $PATH environment variable and displays the first path where echo executable is found. It may be case that executable is placed at other paths of $PATH environment variable as well. To get all paths where executable is present in the system, “-a” option can be used.
$ which -a  echo
/usr/sbin/echo
/bin/echo

Friday, September 28, 2012

Configure "ACTIVE DIRECTORY SERVER" with Samba PDC + OpenLDAP on SUSE LINUX (PART 2)


SETTING LDAP CLIENT
  1. Click YAST | Network Services | LDAP Client
  2. Click Use LDAP pada User Authentication
  3. Fill in Address with server IP or by using 127.0.0.1 as default address
  4. Mark  LDAP TLS/SSL option checked if you choose to use TLS/SSL on previous tutorial, or vice versa, leave it unchecked if you choose to not use TLS on previous tutorial 
  5. Fill in LDAP Base DN (dc=namadomain, dc=tld, ex : dc=vavai,dc=co,dc=id). You may also get the LDAP Base DN by clicking  Fetch DN button
  6. Leave others option as is
    `
  7. Click Advanced Configuration
  8. Change Password Change Protocol to MD5
  9. Leave option Group Member Attribute = Member unchanged
    `

  10. Click Administration Setting
  11. Fill in cn=Administrator on Administrator DN. Don’t forget to give a check on Append Base DN option
  12. Mark a check on Create Default Configuration Objects option
    `
  13. Click OK
  14. Click OK

SETTING SAMBA SERVER PRIMARY DOMAIN CONTROLLER (PDC)
  1. Open YAST | Network Services | Samba Server
  2. Fill in workgroup/domain name on first wizard. I’m usingdomain vavai.co.id as my workgroup name. Click Next
    `
  3. On Samba Server Type option, choose Primary Domain Controller (PDC). Click Next
  4. On start-up tab, choose Service Start During Boot option, so Samba will automatically started on boot. Don’t forget to click Open Port in Firewall if you use firewall on intranet zone
    `
  5. Move to LDAP Setting tab.
  6. Click on Use LDAP Password Back-End
  7. Fill in  Administrator DN and password setting (cn=Administrator,dc=vavai,dc=co,dc=id, adjust it with your domain name). Click Test Connection to test LDAP server connection. If test result is failed, recheck your configuration setting.
    `
  8. Click OK and then fill in Samba root /Administrator password
    `
SETTING USER NAME & PASSWORD
  1. Click on YAST | Security and Users | User & Group Management
  2. Click Expert Options | LDAP User & Group Configuration option on bottom-right-corner menu
  3. Fill in LDAP Admin password (see whether your bind DN configuration has setup correctly)
  4. Move to Configuration Module, and then choose  userconfiguration
    `
  5. Change susemaxpasswordlength with your maximum password length
  6. Change suseminpasswordlength with your minimum password length
  7. Change susepasswordhash from SSHA to  SMD5
  8. Click OK
  9. Click on Set Filter option on top-right-corner menu and choose LDAP Users. This will display all LDAP user list, currently are empty because we have create any user yet
  10. Click Add
  11. Fill in user profile and password
    `
  12. Click OK
Restart all service (or reboot your computer) to test all the service. f you wish to join Windows workstation into Samba PDC+LDAP domain, use the Samba root user name and password as Administrator user. Share folder, Profile, netlogon and custom setting could be modified within YAST | Network Services | Samba Server. Samba LDAP user could be added or modify with the above procedure using YAST | Security & Users | User & Group Management.

Configure "ACTIVE DIRECTORY SERVER" with Samba PDC + OpenLDAP on SUSE LINUX (PART 1)

I have written Samba PDC+OpenLDAP tutorial on openSUSE on previous article but the tutorial are based on manual configuration and need too many steps to make it usable. Now, I want to share how to make Samba PDC+OpenLDAP on openSUSE or SLES with automatic configuration using the YAST way :-) . The tutorial should be easy to understand and and need a few step to make it ready for testing.
INSTALLING OPENSUSE
Install openSUSE 11.2 with or without GUI, choose which one suitable for your purpose. I’m using a GUI example because this tutorial intended for student :-) . a Minimal server selection (text mode) maybe a better option for production server. Please refer to openSUSE 11.2 installation guide if you need an assistance regarding openSUSE installation.
Lucky for Indonesian :-D , I’ve written a PDF tutorial with clear explanation regarding openSUSE installation for this purpose  : Tutorial Instalasi openSUSE 11.2 Versi Server Berbasis GUI

INSTALLING LDAP SERVER
Follow these wizard to install and configure LDAP server :
  1. Open YAST | Software | Software Management
    `
  2. Choose View | Pattern
  3. Scroll to Server Function
  4. Give a checked mark on File Server, DHCP and DNS Server, Directory Server (LDAP)
    `
  5. Click Accept
  6. openSUSE should be automatically detect dependency package. Click Continue to install selected package
    `
  7. Close YAST and then open again. I take this step to make sure YAST refresh new package installation and add to it’s menu
  8. Choose YAST | Network Service | LDAP Server
  9. Click Yes on Start LDAP Server. Give it a check mark on Open Port in Firewall if you use firewall. Leave others as is and then click Next
    `
  10. Click Enable TLS and then create TLS Certificate by using Launch CA Management Module button and follow the wizard. Leave it unchecked if you wish to use LDAP without TLS connection.
    `
  11. On basic database setting fill in the default database setting :
    01.Database Type : hdb
    02.Base DN : dc=domainname, dc=tld
    03.Example :
    04.If my  domain = vavai.co.id, configuration will be like this : Base DN = dc=vavai, dc=co, dc=id
    05.If my domain = vavai.com, configuration will be like this : Base DN = dc=vavai, dc=com
    06.Administrator DN : cn= Administrator. Leave  Append Base DN option checked
    07.Don't forget to fill your  LDAP Password
    08. 
    09.Also, leave a check mark on  "Use this database as the default for OpenLDAP"
    Click Next if all setting has been completed.
    `
  12. Click Finish
    `
ADD SAMBA SCHEMA
  1. Open YAST | Network Services | LDAP Server
  2. Click Schema Files on left pane menu
  3. Click Add and add Samba3.Schema so we will have following LDAP Schema : schema, core, cosine, inetorgperson, rfc2307bis,yast and samba3
    `
  4. Click OK
Next Tutorial are LDAP Client Configuration
UA-39498145-1