Solved

proper file to set up aliases for 1. individual users 2. specific groups  3. all users

Posted on 2006-06-29
7
301 Views
Last Modified: 2010-04-20
been googling to try to find this, and now more confused than I was when I started.

I've got several boxes that multiple users use, a mix of RHEL4 and a few gentoo.  xdm is running on all but one gentoo box, so that's how most users connect.  Several open up bash konsoles, and a few open up ksh shells

What are the generally recognized files used set up aliases that a user will have when s/he logs in, and that won't get overwritten on some update?

What is the generally recognized file used for global aliases, that won't get overwritten on some update?

What are the generally recognized files used for setting up configuration and environment and add aliases and such for specific groups (e.g. accounting, warehouse, admin, powerplant)

Thanks
0
Comment
Question by:amlp
  • 3
7 Comments
 
LVL 5

Accepted Solution

by:
ircpamanager earned 43 total points
ID: 17011087
If i understand you correctly,  each user has a file called .bash_profile and .bashrc in there home directory. They store the individual settings for that users. There is a global file in /etc/profile. As far as group names are concerned they are stored in a file under the /etc directory(/etc/group) RHEL4 has a gui tool if you prefer under system settings called users and groups. Again this is if I understand you correctly.
0
 
LVL 22

Assisted Solution

by:pjedmond
pjedmond earned 41 total points
ID: 17011444
Nice little overview of users and groups:

http://yolinux.com/TUTORIALS/LinuxTutorialManagingGroups.html

although written for yolinux, it is equally applicable to other distros.

(   (()
(`-' _\
 ''  ''
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17021023
>What are the generally recognized files used set up aliases that a user will have when s/he logs in, and >that won't get overwritten on some update?

>What is the generally recognized file used for global aliases, that won't get overwritten on some update?

I presume that you are referring to /etc/aliases, but this is for sendmail

man aliases

for more info.

(   (()
(`-' _\
 ''  ''

0
 
LVL 3

Assisted Solution

by:bryanlloydharris
bryanlloydharris earned 41 total points
ID: 17025635
There are many files for this.  Some global and some only for the user.  User settings override global settings AFAIK.

global:
/etc/profile
/etc/bashrc (this is not on my system but it's on the one at work)

not-global(these are only for the bryan user):
/home/bryan/.bash_profile
/home/bryan/.bashrc

Since I'm a beginner, my config looks like this, to simplify things.  This way, it doesn't matter much because they are both the same:

$ vi .bashrc (and put in your settings)
$ ln -s .bashrc .bash_profile (this makes them both the same)

/home/.bash_profile -> .bashrc (this means it's a symlink, both files have same content)

So if you do "cat .bashrc" and then "cat .bash_profile" they will both be the same.  Sometimes the shell reads .bashrc and sometimes .bash_profile.  It depends if you login at console, remote ssh, or xterm, and so on.  To make things simple, I read a book which says create a symlink and don't worry about it because they are then all the same.  I can't remember the name of the book but it might be "Linux Hacks."
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17026113
Example .bashrc
-----------------8X------------------
[pje@bigserver pje# cat .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
-----------------8X------------------

As you can see, this file creates a number of user specific aliases and also runs /etc/bashrc. The 'default' home set up for a new user normally exists in the /etc/skel directory. By having this default setup copied into the home directory of a new user, then you could change 'alias' directives for all users using bash sh by editing /etc/bashrc

(   (()
(`-' _\
 ''  ''
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now