« March 2006 »
SunMonTueWedThuFriSat
   
7
13
26
28
 
       
Today
XML

Neat blogs

Navigation

Editing

Powered by Roller Weblogger.

statcounter.com

clustrmaps.com

Locations of visitors to this page

technorati.com

20060325 Saturday March 25, 2006
Creating an user account

To create an user account, we use useradd:

[tdh@wont ~]> sudo su -
Sun Microsystems Inc.   SunOS 5.11      snv_35  October 2007
# uname -a
SunOS wont 5.11 snv_35 i86pc i386 i86pc
# useradd -m -u 2001 -g 10 -c "Mr. X" -d /export/home/mrx mrx
64 blocks

We use '-m' to create the directory and stuff it with default options:

     -k skel_dir

         A directory that contains skeleton information (such  as
         .profile)  that  can  be  copied  into a new user's home
         directory. This directory must already exist. The system
         provides  the  /etc/skel  directory that can be used for
         this purpose.

     -m

         Create the new user's home  directory  if  it  does  not
         already  exist. If the directory already exists, it must
         have read, write,  and  execute  permissions  by  group,

SunOS 5.10          Last change: 21 Feb 2006                    4

System Administration Commands                        useradd(1M)

         where group is the user's primary group.

I believe that if '-k' is not specified, then the contents from /etc/skel will be used. The Linux man pages are more explicit about this occuring.

Was it created and did we get the defaults?

# ls -la /export/home/mrx
total 14
drwxr-xr-x   2 mrx      staff        512 Mar 25 19:01 .
drwxr-xr-x   4 root     root         512 Mar 25 19:01 ..
-rw-r--r--   1 mrx      staff       1053 Mar 25 19:01 local.cshrc
-rw-r--r--   1 mrx      staff       1002 Mar 25 19:01 local.login
-rw-r--r--   1 mrx      staff       1019 Mar 25 19:01 local.profile
-rw-r--r--   1 mrx      staff        964 Mar 25 19:01 .profile

By the way, what shell was the user mrx given?

# grep mrx /etc/passwd
mrx:x:2001:10:Mr. X:/export/home/mrx:/bin/sh

Okay, did we get the stuff out of /etc/skel?

# ls -la /etc/skel
total 22
drwxr-xr-x   2 root     sys          512 Mar 21 01:30 .
drwxr-xr-x  81 root     sys         4608 Mar 25 19:01 ..
-rw-r--r--   1 root     sys         1053 Mar  3 14:58 local.cshrc
-rw-r--r--   1 root     sys         1002 Mar  3 14:58 local.login
-rw-r--r--   1 root     sys         1019 Mar  3 14:58 local.profile
-rw-r--r--   1 root     other        964 Mar  3 14:58 .profile

Looks like it. So, to set global defaults for all users, you could go ahead and edit these files. But really, that is a bad idea. An OS upgrade could overwrite them. A better thing would be to make a copy and then use the '-k' option to useradd to get your defaults.

# cd /etc
# cp -rp skel skel.SITE

And we could have then done:

# useradd -m -k /etc/skel.SITE -u 2001 -g 10 -c "Mr. X" -d /export/home/mrx mrx
64 blocks

Lets say that we want to try the shell /bin/tcsh:

[tdh@wont ~]> sudo su - mrx
Sun Microsystems Inc.   SunOS 5.11      snv_35  October 2007
$

That will autologout after a while. We could just do an 'unset autologout':

$ unset autologout

But next time we want to do it, we would have to redo the command. The trick is that we look at the man page for tcsh and find if it finds a ~/.tcshrc file, it will read the contents to initialize itself. We can either add the command to the file, or if it does not exist, create the file:

> set | grep autologout
autologout      60
> ls -la .tcshrc
.tcshrc: No such file or directory
> echo "unset autologout" > .tcshrc
> cat .tcshrc
unset autologout
> exit
$ tcsh
> set | grep autologout

The same applies for the root account. Note that when you first login, you are in the home directory of that account. So to find the .profile for root:

[tdh@wont ~]> su -
Password:
Sun Microsystems Inc.   SunOS 5.11      snv_35  October 2007
# ls -la .profile
.profile: No such file or directory
# pwd
/

We could create a /.profile. We can also read the man page for sh(1) and find out:

  Invocation
     If the shell is invoked through exec(2) and the first  char-
     acter  of  argument  zero  is -, commands are initially read
     from /etc/profile and from  $HOME/.profile,  if  such  files
     exist.

Look at the man pages for the rest of the context!

So, we could modify /etc/profile to change the behaviour of sh(1) for everyone. But another word of caution, be careful doing so.


Technorati Tags:
Orginally posted on Kool Aid Served Daily
Copyright (C) 2006, Kool Aid Served Daily
Fedora Core 5 kernel sources are a bit hard to get to

The RANDOM functionality in iptables is not compiled in by default to Linux kernels. I consider it misleading in that most of the iptables web documentation kinda skip that fact.

Time to build a kernel. The Fedora Core 5 doc pack states:

#yum install yum-utils
#yumdownloader --source kernel

That won't find it. You can try and find this version: kernel-2.6.15-1.2054_FC5.src.rpm, but that is no help if the version changes. What I did was to change this 'enabled=0' line in /etc/yum.repos.d/fedora-core.repo:

[core-source]
name=Fedora Core $releasever - Source
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/source/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

to be:

[core-source]
name=Fedora Core $releasever - Source
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/source/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

I am concerned with these messages when the kernel is being built:

  SHIPPED scripts/genksyms/parse.h
  SHIPPED scripts/genksyms/keywords.c
  HOSTCC  scripts/genksyms/lex.o
scripts/genksyms/lex.c:546:5: warning: "YY_STACK_USED" is not defined
scripts/genksyms/lex.c:1424:5: warning: "YY_ALWAYS_INTERACTIVE" is not defined
scripts/genksyms/lex.c:1427:5: warning: "YY_NEVER_INTERACTIVE" is not defined
scripts/genksyms/lex.c:1718:5: warning: "YY_MAIN" is not defined
  SHIPPED scripts/genksyms/parse.c
  HOSTCC  scripts/genksyms/parse.o
scripts/genksyms/parse.c:819:6: warning: "YYLTYPE_IS_TRIVIAL" is not defined

I'm following the instructions at The Release Notes.

Well, not exactly! I was doing this:

[tdh@mrx linux-2.6.15.i686]> cp configs/kernel-2.6.15-i686.config .

instead of this:

[tdh@mrx linux-2.6.15.i686]> cp configs/kernel-2.6.15-i686.config .config

Much better, now I get is instead:

  HOSTCC  scripts/kconfig/zconf.tab.o
scripts/kconfig/zconf.tab.c:754:6: warning: "YYLTYPE_IS_TRIVIAL" is not defined
  HOSTLD  scripts/kconfig/conf

Update #1: A vanilla build does not show this same problem, so I'm thinking it has something to do with the Fedora patches.


Technorati Tags:
Orginally posted on Kool Aid Served Daily
Copyright (C) 2006, Kool Aid Served Daily