LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-03-2004, 01:07 PM   #1
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Rep: Reputation: 15
Fail to add user accout manully


I create user manually according the following steps
(1) vi /etc/group ------Guest:x:700:
(2) mkdir /home/peter
(3) vi /etc/passwd----peter:x:555:700::/home/peter:/bin/bash
(4) pwconv
(5) passwd peter---xxx.......
(6) cp -r /etc/skel /home/peter
(7) chown -R peter:Guest /home/peter
But when i try to use peter to login , it fail and show ..........what's that ?

login: peter
Password:
-bash-2.05b$
 
Old 08-03-2004, 01:30 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
login: peter
Password:
-bash-2.05b$
Your login worked (meaning your account worked). The problem is with step #6:
Quote:
(6) cp -r /etc/skel /home/peter
What that command did was to copy the /etc/skel directory directly to /home/peter. In other words, you made a /home/peter/skel directory. You probably wanted to do this:

cp -r /etc/skel/* /home/peter

With the command originally used, the .bash_profile and other files (used to control the bash prompt and other things) were put in /home/peter/skel, and not /home/peter (where they are expected to be).
 
Old 08-04-2004, 04:44 AM   #3
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Original Poster
Rep: Reputation: 15
Sorry, I also don't know what u mean.
if I show the content of directory /etc/skel, it is nothing.

[root@localhost skel]# pwd
/etc/skel
[root@localhost skel]# ls
[root@localhost skel]#

Also if I type the following command it show................
[root@localhost /]# cp -r /etc/skel/* /home/peter
cp: cannot stat `/etc/skel/*': No such file or directory
 
Old 08-04-2004, 08:54 AM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Actually, the command I gave before is still lacking. You would probably need two commands:
cp -r /etc/skel/* /home/peter
cp -r /etc/skel/.* /home/peter


Ok, some explanation is in order.

1: "-bash-2.05b$" is the default prompt for bash. Bash will use that command prompt if the user does not have anything specified in his/her configuration files.

2: The configuration files are stored in the user's home directory (/home/peter). There are a few of them, but the ones typically used are .bash_profile and .bashrc. The dot ( . ) at the beginning of those filenames make them hidden; they will not show up on an ls command unless you use the -a or -A argument (for example, ls -al /home/peter).

3: The /etc/skel directory is supposed to contain basic configuration files to help in creating new users. Specifically, it should contain basic versions of .bash_profile and .bashrc. The reason you copy the contents of /etc/skel to the home directory is so the new user gets those basic configuration files. Those files will have the same names as mentioned previously, and that means they will not show up unless you use the -a or -A argument to ls.

If you do this command: ls -al /etc/skel
and you still get no output, then your /etc/skel directory is empty. Either your distribution did not place basic configuration files there or it expects you (as the administrator) to make your own.

The point is, the account you added did work. It's not a problem with the account working, it's a problem with the account having the expected configuration.
 
Old 08-04-2004, 09:04 AM   #5
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Original Poster
Rep: Reputation: 15
Thanks you very much !!!
I get it
 
Old 08-04-2004, 09:44 AM   #6
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Original Poster
Rep: Reputation: 15
Sorry, I have one more question. Is it mean that if I want to copy all hidden files from one directory to another directory. I need to add "." before "*". Otherwise it not work.

cp -r /etc/skel/.* /home/peter
 
Old 08-04-2004, 11:38 AM   #7
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Exactly. When you use * by itself, the command will only copy non-hidden files. You must force it to copy hidden files by putting the dot in front of the *.
 
Old 08-06-2004, 08:02 AM   #8
rkdugar
LQ Newbie
 
Registered: Jul 2004
Posts: 13

Rep: Reputation: 0
The dot in front of the * does not perform the specified task. The command "cp -r /etc/skel/.* /home/peter" will copy all the files in the /etc directory in the /home/peter directory.

Check using the following command:

ls -la /home/peter
 
Old 08-06-2004, 08:16 AM   #9
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Original Poster
Rep: Reputation: 15
Thanks all of you !!!
 
Old 08-06-2004, 10:33 AM   #10
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
Originally posted by rkdugar
The dot in front of the * does not perform the specified task. The command "cp -r /etc/skel/.* /home/peter" will copy all the files in the /etc directory in the /home/peter directory.
Not exactly. If there are any files that are not hidden placed into /etc/skel (such as a new user startup guide, basic data for a specific application, or a common non-hidden directory structure), then copying only ".*" will not get all the files in the /etc/skel directory.
 
Old 08-06-2004, 06:25 PM   #11
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Rep: Reputation: 30
By turning dotglobbing on for the current bash shell,

Code:
shopt -s dotglob
You can set your '*' to expand to all files/directories, even those starting with a '.' character.

Just
Code:
shopt
will tell you whether is currently on or not.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fail to add speedstep-ich module elvislu Linux - Laptop and Netbook 3 04-03-2005 04:15 AM
New user accounts fail on login RC_Baker Red Hat 0 03-23-2005 05:13 PM
Fail to add a local user in a computer working with NIS pwangee Fedora 2 07-07-2004 09:28 PM
Fail to add a local user in a computer working with NIS pwangee Linux - Networking 0 07-07-2004 10:01 AM
how to setup a user accout Longinus Linux - Newbie 4 03-14-2004 08:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:15 PM.

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
Open Source Consulting | Domain Registration