Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ?
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).
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
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.
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.
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 *.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.