LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Newbie Linux Server Question (https://www.linuxquestions.org/questions/linux-newbie-8/newbie-linux-server-question-847810/)

rajuraju1 12-01-2010 08:51 PM

Newbie Linux Server Question
 
Hi everyone,

So far, I have created a couple of groups and put some users in them. But now I want to create a template for the .bashrc,.bash_profile, .bash_login, and .bash_logout. I have no idea where to begin! Also, a login banner when the user logs in would be cool :)

onebuck 12-01-2010 09:08 PM

Hi,

Welcome to LQ!

Quote:

Originally Posted by rajuraju1 (Post 4177701)
Hi everyone,
So far, I have created a couple of groups and put some users in them. But now I want to create a template for the .bashrc,.bash_profile, .bash_login, and .bash_logout. I have no idea where to begin! Also, a login banner when the user logs in would be cool
:)


What have you attempted other than the group actions?
You could setup a .bashrc & .bash_profile for your user(s);
Code:

  sample .bash_profile;
 
~$ cat .bash_profile
 
# .bash_profile
 
#08-30-06 12:21
 
#
 
# Source .bashrc
 
if [ -f ~/.bashrc ]; then
 
        . ~/.bashrc
 
fi


Code:

sample .bashrc;
 
:~$ cat .bashrc
 
 
#.bashrc
 
#08-30-06 12:20

# Add bin to path

export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"

#export PATH="$PATH:$HOME/bin"

# Dynamic resizing
 
shopt -s checkwinsize

# Custom prompt
 
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

#08-29-06 11:40

if [ `id -un` = root ]; then
 
  PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
 
else
 
  PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '
 
fi

#
 
# Add color
 
eval `dircolors -b`

# User defined aliases
 
alias cls='clear'
 
alias clls='clear; ls'
 
alias ll='ls -l'
 
alias lsa='ls -A'
 
alias lsg='ls | grep'
 
alias lsp='ls -1 /var/log/packages/ > package-list'
 
alias na='nano'
 
alias web='links -g -download-dir ~/ www.google.com'

#08-29-06 11:50

#To clean up and cover your tracks once you log off
 
#Depending on your version of BASH, you might have to use
 
# the other form of this command
 
  trap "rm -f ~$LOGNAME/.bash_history" 0

#The older KSH-style form
 
#  trap 0 rm -f ~$LOGNAME/.bash_history

The .bashrc is very useful!
If you want to learn 'bash' then start out at items 4, 5 and 6 below.


System Administration would be good to look at 1,2 & 7. While the others will provide some additional information.

Just a few links to aid you to gaining some understanding;


1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Getting Started with Linux

The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

gd2shoe 12-01-2010 09:45 PM

The /etc/skel directory is the "template" from which home directories are built. That won't help with any users already created, but may be useful for future ones.

Check out the man page for bash (near the top, under INVOCATION). You'll see that there are some files under /etc that may also be interesting. ("man bash", use 'q' to quit.)

Also, it would be helpful to know which distribution you're working with.

rajuraju1 12-02-2010 10:54 PM

Quote:

Originally Posted by gd2shoe (Post 4177739)
The /etc/skel directory is the "template" from which home directories are built. That won't help with any users already created, but may be useful for future ones.

Check out the man page for bash (near the top, under INVOCATION). You'll see that there are some files under /etc that may also be interesting. ("man bash", use 'q' to quit.)

Also, it would be helpful to know which distribution you're working with.

This is what I was doing when I created my users previously (adduser command), but if I wanted to edit my bashprofile for future users, would I do this directly from etc/skel?

and thanks for the script! :)

gd2shoe 12-03-2010 12:19 AM

Changes to /etc/profile will affect all users. Changes to /etc/skel/.bash_profile will only affect new accounts created.

rajuraju1 12-03-2010 11:30 AM

Quote:

Originally Posted by gd2shoe (Post 4179148)
Changes to /etc/profile will affect all users. Changes to /etc/skel/.bash_profile will only affect new accounts created.

Good to know. Thanks!


All times are GMT -5. The time now is 03:30 PM.