LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-01-2010, 09:51 PM   #1
rajuraju1
LQ Newbie
 
Registered: Dec 2010
Posts: 3

Rep: Reputation: 0
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
 
Old 12-01-2010, 10:08 PM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,542
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Welcome to LQ!

Quote:
Originally Posted by rajuraju1 View Post
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!
 
Old 12-01-2010, 10:45 PM   #3
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
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.
 
Old 12-02-2010, 11:54 PM   #4
rajuraju1
LQ Newbie
 
Registered: Dec 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by gd2shoe View Post
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!
 
Old 12-03-2010, 01:19 AM   #5
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Changes to /etc/profile will affect all users. Changes to /etc/skel/.bash_profile will only affect new accounts created.
 
Old 12-03-2010, 12:30 PM   #6
rajuraju1
LQ Newbie
 
Registered: Dec 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by gd2shoe View Post
Changes to /etc/profile will affect all users. Changes to /etc/skel/.bash_profile will only affect new accounts created.
Good to know. Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Server and Linux Newbie question makismagoo99 Linux - Server 3 11-15-2006 08:26 PM
linux mail server newbie question threegig Linux - Newbie 2 05-16-2006 04:39 AM
Linux Newbie Question! (Web Server Related) ste_brough Linux - Distributions 1 02-03-2004 10:24 AM
Newbie Linux Server Question jacksmash Linux - Newbie 7 11-18-2003 03:41 PM


All times are GMT -5. The time now is 08:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration