sslug-teknik team mailing list archive
-
sslug-teknik team
-
Mailing list archive
-
Message #94533
Re: loutout session med kommando??
2008/2/20 <soeren.koch@xxxxxxxx>:
> Well Under linkux kan du bare bruge .bash_profile og i bunden af den tilføje de komandoer der skal udføres og så tilsidst logout:
>
> cat /home/test/.bash_profile
>
> # .bash_profile
>
> # Get the aliases and functions
> if [ -f ~/.bashrc ]; then
> . ~/.bashrc
> fi
>
> # User specific environment and startup programs
>
> PATH=$PATH:$HOME/bin
>
> export PATH
> unset USERNAME
>
> echo 'test'
>
> sleep 1
>
> logout
>
>
>
> Søren Koch
> Udviklingsingeniør
> Direkte telefon +45 4677 5816
> Email: soeren.koch@xxxxxxxx
>
> Afdelingen for Brændselsceller og Faststofkemi
> Forskningscenter Risø
> Danmarks Tekniske Universitet
> Bygning 228, Postboks 49
> 4000 Roskilde
> Tel +45 4677 5800
> Fax +45 4677 5858
> www.risoe.dk
> Sikker e-post sendes til risoe@xxxxxxxx
>
> Forskningscenter Risø, Danmarks Fødevareforskning, Danmarks Fiskeriundersøgelser,
> Danmarks Rumcenter og Danmarks TransportForskning er den 1. januar 2007 lagt sammen med
> Danmarks Tekniske Universitet med DTU som den fortsættende enhed.
>
Hvis sikkerhed er højt prioritet på pågældende maskine, jeg er ikke
sikkert at sørens forslag er nok:
vmware@vmware:~$ sudo su -
vmware:~# adduser phonny
Adding user `phonny' ...
Adding new group `phonny' (1002) ...
Adding new user `phonny' (1000) with group `phonny' ...
Creating home directory `/home/phonny' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for phonny
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [y/N] y
vmware:~# ls -la /home/phonny/
total 20
drwxr-xr-x 2 phonny phonny 4096 2008-02-19 06:41 .
drwxr-xr-x 5 root root 4096 2008-02-19 06:41 ..
-rw-r--r-- 1 phonny phonny 220 2008-02-19 06:41 .bash_logout
-rw-r--r-- 1 phonny phonny 414 2008-02-19 06:41 .bash_profile
-rw-r--r-- 1 phonny phonny 2227 2008-02-19 06:41 .bashrc
vmware:~# cat > /home/phonny/.bash_profile <<EOF
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/login.defs
#umask 022
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
echo 'test'
sleep 1
logout
EOF
vmware:~# su - phonny
test
vmware:~# ssh phonny@localhost ls
phonny@localhost's password:
vmware:~# ssh phonny@localhost date
phonny@localhost's password:
Tue Feb 19 06:43:21 CET 2008
phonny@localhost's password:
rm: remove regular file `/home/phonny/.bash_profile'? y
phonny@localhost's password:
cat: /home/phonny/.bash_profile: No such file or directory
:-(
Min forslag:
- opret en nyt (chroot) shell med bestemt enviorment, så er du sikkert
hvad bestemt bruger kan gøre,
- hvis guest bruger skal virklig have X-session tjek
permissions/indhold af ~.xinitrc, $HOME/.Xdefaults, .xsession filer.
Mvh, admir trakic
>
>
> > -----Original Message-----
> > From: Torben Andersen [mailto:Torben.Andersen@xxxxxxxxxxxxxxxxxx]
> > Sent: Wednesday, February 20, 2008 9:52 AM
> > To: sslug-teknik@xxxxxxxx
> > Subject: [TEKNIK] loutout session med kommando??
> >
> > Hej,
> >
> > Styrer en række Solaris/Linux produktionsmaskiner. Jeg har
> > behov for at lade operatører logge ind som en specialbruger
> > for at udføre en bestemt kommando.
> >
> > Jeg har oprettet en bruger og editeret .login filen til at
> > udføre denne kommando.
> >
> > Problemet er, at maskinen starter desktoppen og ikke logger
> > ud igen. Jeg vil gerne, at når .login er udført, logges ud,
> > så andre brugere kan logge ind.
> >
> > Best Regards/Med venlig hilsen
> > Torben Andersen
> > Production Engineer
> >
> > Flextronics
> > Special Business Solutions
> > Hjortevej 4
> > DK-7800 Skive
> > Denmark
> >
> > +45 96 14 30 00 main
> > +45 96 14 31 50 direct
> > +45 96 14 31 44 fax
> > +45 xx xx xx xx mobile
> >
> > http://www.flextronics.com
> >
> >
> > Legal Disclaimer:
> > The information contained in this message may be privileged
> > and confidential. It is intended to be read only by the
> > individual or entity to whom it is addressed or by their
> > designee. If the reader of this message is not the intended
> > recipient, you are on notice that any distribution of this
> > message, in any form, is strictly prohibited. If you have
> > received this message in error, please immediately notify the
> > sender and delete or destroy any copy of this message
> >
> >
> >
> >
>
>
>
--
.''`. Admir Trakic
: :' : Debian Gnu/Linux user #99405
`. `' http://www.trakic.com/
`-
References