Sunday 14 February 2016

Add Environmental (Path) Variable in Linux

1. Open .bashrc file.

      gedit .bashrc

2. Add path in basrc file like this: (In this care our runnable file is in bin directory.)

PATH=/usr/ansys_inc/v162/ansys/bin:$PATH
export PATH


3. Update the environmental.

source .bashrc

Done!




How to add user into sudoers in Red Hat Linux server


Manual way:
  • change to root
  • change directories to /etc
  • allow to write to sudoers file which READ-ONLY by default
  • add line with user in question and allow him to use sudo
su
cd /etc
ls -l
chmod +w sudoers
gedit sudoers
--- scroll down in file and find line (root ALL=(ALL) ALL) ---
---- right there add this for the user (example userid: ranjeet)---
root ALL=(ALL) ALL
ranjeet ALL=(ALL) ALL

Exit & Save
chmod -w sudoers  (make the sudoers READ-ONLY again)
All is done and now user “ranjeet” can use elevated right with use of sudo before the command. However if you have too many users to add, it would make sense add them to group and and add the group to sudoers instead of all separate users :-)