Customize User Configurations

2009-05-13 11:46:58来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

Now that you know how to set up a useful environment for yourself, it's time to share the wealth.
It's very easy for a system administrator to ensure that each newly created user starts out with the same configuration files. For example, every user can receive the same customized prompt, shell variables, or hotkeys.
Whenever you create a new user, several default (and hidden, or dot, files) are copied into the new user's home directory. In FreeBSD, the source of these files is /usr/share/skel/. Any customizations you make to these files will be seen by all subsequently created users. Do note that you'll have to manually copy over any modified files to existing users.
It's useful to understand these files, as they apply to every user you create. Depending upon your needs, you'll probably end up removing some of the defaults, customizing others, and even adding a few of your own.
1.10.1 Default Files
Let's take a quick tour of the default files:
% ls -l /usr/share/skel
total 24
drwxr-xr-x 2 root   wheel   512 Jul 28 16:09 ./
drwxr-xr-x   27 root   wheel   512 Jul 28 16:06 ../
-rw-r--r-- 1 root   wheel   921 Jul 28 16:09 dot.cshrc
-rw-r--r-- 1 root   wheel   248 Jul 28 16:09 dot.login
-rw-r--r-- 1 root   wheel   158 Jul 28 16:09 dot.login_conf
-rw------- 1 root   wheel   371 Jul 28 16:09 dot.mail_aliases
-rw-r--r-- 1 root   wheel   331 Jul 28 16:09 dot.mailrc
-rw-r--r-- 1 root   wheel   797 Jul 28 16:09 dot.profile
-rw------- 1 root   wheel   276 Jul 28 16:09 dot.rhosts
-rw-r--r-- 1 root   wheel   975 Jul 28 16:09 dot.shrc
Note that each starts with the word dot. However, when the files are copied into a user's home directory, the dots turn into literal dots (.). Also, the files in this directory are owned by root, but when a new user is created, the copied over files will change ownership as they are placed in that user's home directory.
1.10.1.1 dot.cshrc
Let's examine each default file, starting with dot.cshrc. ( [Hack #2] introduced several .cshrc hacks.) If you'd like new users to receive your customizations, simply replace /usr/share/skel/dot.cshrc with your hacked version of .cshrc. Don't forget to rename the file as you copy it:
# cp /root/.cshrc /usr/share/skel/dot.cshrc
Here, I overwrote the default dot.cshrc by copying over the superuser's customized version of .cshrc. Although you could edit /usr/share/skel/dot.cshrc directly, you may find it more convenient to have a customized copy stored elsewhere.
All isn't lost if you already have existing users whom you'd like to receive this file. First, find out what users already exist and have home directories. This is a quick way to do so:
# ls /usr/home
dru test
Since this system has only two existing users, it's an easy matter to copy over my customized .cshrc. I'm also a lazy typist, so I use ~ instead of typing out /usr/home. Also note that I have to remember to manually change ownership:

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:ssh登陆运行的程序如何在断开连接之后还能继续?

下一篇:用portsnap升级FreeBSD 6.0的port tree