PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > how to change user in shell
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

how to change user in shell

Réponse
 
LinkBack Outils de la discussion
Vieux 06/12/2006, 12h51   #1
neoedmund
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut how to change user in shell

i login as userA
in a shell X, i want to run shell Y in name of userB,
i know both password of userA and userB
how can i do it?
thanks!

  Réponse avec citation
Vieux 06/12/2006, 13h08   #2
Janis Papanagnou
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell

neoedmund wrote:
> i login as userA
> in a shell X, i want to run shell Y in name of userB,
> i know both password of userA and userB
> how can i do it?
> thanks!
>


The command to switch user is

su - userB

If the users default shell is not shell Y then simply
start it, e.g. if Y is a Kornshell...

ksh

To leave the new shell type exit.
To leave the su command type exit.

Janis
  Réponse avec citation
Vieux 07/12/2006, 00h27   #3
neoedmund
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell


Janis Papanagnou $B$N%a%C%;!<%8(B:

> neoedmund wrote:
> > i login as userA
> > in a shell X, i want to run shell Y in name of userB,
> > i know both password of userA and userB
> > how can i do it?
> > thanks!
> >

>
> The command to switch user is
>
> su - userB
>
> If the users default shell is not shell Y then simply
> start it, e.g. if Y is a Kornshell...
>
> ksh
>
> To leave the new shell type exit.
> To leave the su command type exit.
>
> Janis


thanks, but su - userB will ask for password on the console, i'd like
to make "su - userB" automaticly in shell X without user interactive.
how to do it? thanks in advance.

  Réponse avec citation
Vieux 07/12/2006, 01h01   #4
Janis Papanagnou
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell

neoedmund wrote:
> Janis Papanagnou $B$N%a%C%;!<%8(B:
>
>
>>neoedmund wrote:
>>
>>>i login as userA
>>>in a shell X, i want to run shell Y in name of userB,
>>>i know both password of userA and userB
>>>how can i do it?
>>>thanks!
>>>

>>
>>The command to switch user is
>>
>>su - userB
>>
>>If the users default shell is not shell Y then simply
>>start it, e.g. if Y is a Kornshell...
>>
>>ksh
>>
>>To leave the new shell type exit.
>>To leave the su command type exit.
>>
>>Janis

>
>
> thanks, but su - userB will ask for password on the console, i'd like
> to make "su - userB" automaticly in shell X without user interactive.
> how to do it? thanks in advance.
>


What do you think passwords are for?

Lookup command 'expect' for a deprecated way to pass the password.

Janis
  Réponse avec citation
Vieux 07/12/2006, 01h13   #5
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell

On 6 Dec 2006 16:27:43 -0800, neoedmund
<neoedmund@gmail.com> wrote:
>
> Janis Papanagnou $B$N%a%C%;!<%8(B:
>
>> neoedmund wrote:
>> > i login as userA
>> > in a shell X, i want to run shell Y in name of userB,
>> > i know both password of userA and userB
>> > how can i do it?
>> > thanks!
>> >

>>
>> The command to switch user is
>>
>> su - userB
>>
>> If the users default shell is not shell Y then simply
>> start it, e.g. if Y is a Kornshell...
>>
>> ksh
>>
>> To leave the new shell type exit.
>> To leave the su command type exit.
>>
>> Janis

>
> thanks, but su - userB will ask for password on the console, i'd like
> to make "su - userB" automaticly in shell X without user interactive.
> how to do it? thanks in advance.
>

Start the script as root, use sudo, or set up .ssh/authorized_keys and
ssh userB@localhost


--
When a float occurs on the same page as the start of a supertabular
you can expect unexpected results.
-- Documentation of supertabular.sty
  Réponse avec citation
Vieux 07/12/2006, 04h40   #6
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell

In article <1165451263.720470.220230@l12g2000cwl.googlegroups .com>,
"neoedmund" <neoedmund@gmail.com> wrote:

> Janis Papanagnou $B$N%a%C%;!<%8(B:
>
> > neoedmund wrote:
> > > i login as userA
> > > in a shell X, i want to run shell Y in name of userB,
> > > i know both password of userA and userB
> > > how can i do it?
> > > thanks!
> > >

> >
> > The command to switch user is
> >
> > su - userB
> >
> > If the users default shell is not shell Y then simply
> > start it, e.g. if Y is a Kornshell...
> >
> > ksh
> >
> > To leave the new shell type exit.
> > To leave the su command type exit.
> >
> > Janis

>
> thanks, but su - userB will ask for password on the console, i'd like
> to make "su - userB" automaticly in shell X without user interactive.
> how to do it? thanks in advance.


You wrote "I know both password of userA and userB." How do you expect
to prove this if you don't want it to ask for the password?

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
  Réponse avec citation
Vieux 07/12/2006, 13h42   #7
neoedmund
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell


Barry Margolin $B$N%a%C%;!<%8(B:

> In article <1165451263.720470.220230@l12g2000cwl.googlegroups .com>,
> "neoedmund" <neoedmund@gmail.com> wrote:
>
> > Janis Papanagnou $B$N%a%C%;!<%8(B:
> >
> > > neoedmund wrote:
> > > > i login as userA
> > > > in a shell X, i want to run shell Y in name of userB,
> > > > i know both password of userA and userB
> > > > how can i do it?
> > > > thanks!
> > > >
> > >
> > > The command to switch user is
> > >
> > > su - userB
> > >
> > > If the users default shell is not shell Y then simply
> > > start it, e.g. if Y is a Kornshell...
> > >
> > > ksh
> > >
> > > To leave the new shell type exit.
> > > To leave the su command type exit.
> > >
> > > Janis

> >
> > thanks, but su - userB will ask for password on the console, i'd like
> > to make "su - userB" automaticly in shell X without user interactive.
> > how to do it? thanks in advance.

>
> You wrote "I know both password of userA and userB." How do you expect
> to prove this if you don't want it to ask for the password?


I am ready to provide the password by a text file or some readable
string.
the password and security is not mean to me in this case, the
automation is mean to me because i donnot like to type password in
every task and at any time. and i have no root password.
have i something wrong?

the method of ssh provided by Bill is reasonable, thanks to all.

  Réponse avec citation
Vieux 07/12/2006, 18h02   #8
Old Man
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell

neoedmund wrote:
> Barry Margolin $B$N%a%C%;!<%8(B:
>
>
>>In article <1165451263.720470.220230@l12g2000cwl.googlegroups .com>,
>> "neoedmund" <neoedmund@gmail.com> wrote:
>>
>>
>>>Janis Papanagnou $B$N%a%C%;!<%8(B:
>>>
>>>
>>>>neoedmund wrote:
>>>>
>>>>>i login as userA
>>>>>in a shell X, i want to run shell Y in name of userB,
>>>>>i know both password of userA and userB
>>>>>how can i do it?
>>>>>thanks!
>>>>>
>>>>
>>>>The command to switch user is
>>>>
>>>>su - userB
>>>>
>>>>If the users default shell is not shell Y then simply
>>>>start it, e.g. if Y is a Kornshell...
>>>>
>>>>ksh
>>>>
>>>>To leave the new shell type exit.
>>>>To leave the su command type exit.
>>>>
>>>>Janis
>>>
>>>thanks, but su - userB will ask for password on the console, i'd like
>>>to make "su - userB" automaticly in shell X without user interactive.
>>>how to do it? thanks in advance.

>>
>>You wrote "I know both password of userA and userB." How do you expect
>>to prove this if you don't want it to ask for the password?

>
>
> I am ready to provide the password by a text file or some readable
> string.
> the password and security is not mean to me in this case, the
> automation is mean to me because i donnot like to type password in
> every task and at any time. and i have no root password.
> have i something wrong?
>
> the method of ssh provided by Bill is reasonable, thanks to all.
>


What seems to be missing here is the concept of why a password is
required and a refusal to accept that concept. In the realm of
security, the password must not be compromised. Putting it into a text
file is totally unacceptable. Have you ever considered "why the writers
of the software made it this way in the first place?"

For those who are willing to compromise "their own" security, whether
right or wrong, the writers of SSH gave a way to use a passwordless
secure certificate as someone already stated in this thread. This is a
very reasonable approach to circumventing the system security.

Think about this for a moment: Automated logins are like posting your
door keys outside on a bulletin board with your address and the hours
that you won't be at home?

If I may be allowed a tacky moment: Have you tried installing a UPS on
the system, logging into the system, then never logout? It would save
you a lot of precious time. You could power off the terminal screens
for security. Tacky off.

This is a good technical forum with "free" answers and minimum effort on
your part. There are many capable contributors that others get
started in the UNIX world without the years of grief that it would take
without these folks assistance. You could say that this forum is hosted
by the "good guys".

  Réponse avec citation
Vieux 08/12/2006, 13h53   #9
neoedmund
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell


Old Man $B$N%a%C%;!<%8(B:

> neoedmund wrote:
> > Barry Margolin $B$N%a%C%;!<%8(B:
> >
> >
> >>In article <1165451263.720470.220230@l12g2000cwl.googlegroups .com>,
> >> "neoedmund" <neoedmund@gmail.com> wrote:
> >>
> >>
> >>>Janis Papanagnou $B$N%a%C%;!<%8(B:
> >>>
> >>>
> >>>>neoedmund wrote:
> >>>>
> >>>>>i login as userA
> >>>>>in a shell X, i want to run shell Y in name of userB,
> >>>>>i know both password of userA and userB
> >>>>>how can i do it?
> >>>>>thanks!
> >>>>>
> >>>>
> >>>>The command to switch user is
> >>>>
> >>>>su - userB
> >>>>
> >>>>If the users default shell is not shell Y then simply
> >>>>start it, e.g. if Y is a Kornshell...
> >>>>
> >>>>ksh
> >>>>
> >>>>To leave the new shell type exit.
> >>>>To leave the su command type exit.
> >>>>
> >>>>Janis
> >>>
> >>>thanks, but su - userB will ask for password on the console, i'd like
> >>>to make "su - userB" automaticly in shell X without user interactive.
> >>>how to do it? thanks in advance.
> >>
> >>You wrote "I know both password of userA and userB." How do you expect
> >>to prove this if you don't want it to ask for the password?

> >
> >
> > I am ready to provide the password by a text file or some readable
> > string.
> > the password and security is not mean to me in this case, the
> > automation is mean to me because i donnot like to type password in
> > every task and at any time. and i have no root password.
> > have i something wrong?
> >
> > the method of ssh provided by Bill is reasonable, thanks to all.
> >

>
> What seems to be missing here is the concept of why a password is
> required and a refusal to accept that concept. In the realm of
> security, the password must not be compromised. Putting it into a text
> file is totally unacceptable. Have you ever considered "why the writers
> of the software made it this way in the first place?"
>
> For those who are willing to compromise "their own" security, whether
> right or wrong, the writers of SSH gave a way to use a passwordless
> secure certificate as someone already stated in this thread. This is a
> very reasonable approach to circumventing the system security.
>
> Think about this for a moment: Automated logins are like posting your
> door keys outside on a bulletin board with your address and the hours
> that you won't be at home?
>
> If I may be allowed a tacky moment: Have you tried installing a UPS on
> the system, logging into the system, then never logout? It would save
> you a lot of precious time. You could power off the terminal screens
> for security. Tacky off.
>
> This is a good technical forum with "free" answers and minimum effort on
> your part. There are many capable contributors that others get
> started in the UNIX world without the years of grief that it would take
> without these folks assistance. You could say that this forum is hosted
> by the "good guys".



thank you Old Man,
saving password to plain text file may not always be unacceptable,
because i think you can set the permission to self-readonly,
so only the file owner and root can access the content.
am i right?

  Réponse avec citation
Vieux 08/12/2006, 16h34   #10
Old Man
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to change user in shell

--
"neoedmund" <neoedmund@gmail.com> wrote in message
news:1165586016.860414.286000@j72g2000cwa.googlegr oups.com...

Old Man $B$N%a%C%;!<%8(B:

> neoedmund wrote:
> > Barry Margolin $B$N%a%C%;!<%8(B:
> >
> >
> >>In article <1165451263.720470.220230@l12g2000cwl.googlegroups .com>,
> >> "neoedmund" <neoedmund@gmail.com> wrote:
> >>
> >>
> >>>Janis Papanagnou $B$N%a%C%;!<%8(B:
> >>>
> >>>
> >>>>neoedmund wrote:
> >>>>
> >>>>>i login as userA
> >>>>>in a shell X, i want to run shell Y in name of userB,
> >>>>>i know both password of userA and userB
> >>>>>how can i do it?
> >>>>>thanks!
> >>>>>
> >>>>
> >>>>The command to switch user is
> >>>>
> >>>>su - userB
> >>>>
> >>>>If the users default shell is not shell Y then simply
> >>>>start it, e.g. if Y is a Kornshell...
> >>>>
> >>>>ksh
> >>>>
> >>>>To leave the new shell type exit.
> >>>>To leave the su command type exit.
> >>>>
> >>>>Janis
> >>>
> >>>thanks, but su - userB will ask for password on the console, i'd like
> >>>to make "su - userB" automaticly in shell X without user interactive.
> >>>how to do it? thanks in advance.
> >>
> >>You wrote "I know both password of userA and userB." How do you expect
> >>to prove this if you don't want it to ask for the password?

> >
> >
> > I am ready to provide the password by a text file or some readable
> > string.
> > the password and security is not mean to me in this case, the
> > automation is mean to me because i donnot like to type password in
> > every task and at any time. and i have no root password.
> > have i something wrong?
> >
> > the method of ssh provided by Bill is reasonable, thanks to all.
> >

>
> What seems to be missing here is the concept of why a password is
> required and a refusal to accept that concept. In the realm of
> security, the password must not be compromised. Putting it into a text
> file is totally unacceptable. Have you ever considered "why the writers
> of the software made it this way in the first place?"
>
> For those who are willing to compromise "their own" security, whether
> right or wrong, the writers of SSH gave a way to use a passwordless
> secure certificate as someone already stated in this thread. This is a
> very reasonable approach to circumventing the system security.
>
> Think about this for a moment: Automated logins are like posting your
> door keys outside on a bulletin board with your address and the hours
> that you won't be at home?
>
> If I may be allowed a tacky moment: Have you tried installing a UPS on
> the system, logging into the system, then never logout? It would save
> you a lot of precious time. You could power off the terminal screens
> for security. Tacky off.
>
> This is a good technical forum with "free" answers and minimum effort on
> your part. There are many capable contributors that others get
> started in the UNIX world without the years of grief that it would take
> without these folks assistance. You could say that this forum is hosted
> by the "good guys".



thank you Old Man,
saving password to plain text file may not always be unacceptable,
because i think you can set the permission to self-readonly,
so only the file owner and root can access the content.
am i right?

-----------------
You are correct in concept, but reality provides some caveats. I have
been personally burned by doing what you described. In this long
response, these two situations were real events, regardless of right or
wrong or specifications:

1. I had a home directory on a system that was archived on remote
tape silo using a tar format. The tape was left laying unprotected
overnight by the lazy backup operator. A malicious co-worker that
exists in most groups, read the tape onto "his" system in a subdirectory
of his home directory, then replaced the tape. He extracted data at his
wishes from the archived data. Since I had many programs with
read-only passwords, he trashed me in front of the group and manager
by revealing information that only I could have known from files he
recovered. I know this for fact since I got the "root" holder to
investigate
the bad boy's directories.

2. In another company, I had a system with home directories for many
people. I wrote scripts that were only in "my" home directory. All of my
password files were read-only to me. My home directory was
searchable/readable by all (755). Another kind co-worker copied my
whole directory to his home, cruised my files, and used files "still in
development" to make me look really bad. Since this system was not
tape archived, I again had passwords in files. He now had access to
everything that was not ready to be released.

The primary moral is that even though you have read-only on a file,
it is still bad practice because, as I have experienced, I did not have
full control on other factors or actors.

If you want to protect your home from copying by other sweeter
darlings of the "team", make your home directory unsearchable and
unreadable by group or other.

Another lesson: After making all of my directories and
subdirectories inaccessible to anyone but me (700), I was accused by
the group as "not being a team worker".

Do you see this as a negative response? Live through what I did and
you will learn what negative really is.

I think that it would be very nice if you could learn from my mistakes.
I am still a group-non-teamworker; all of my directories have permissions
of 700. I don't have clear-text passwords anywhere except in my PDA.
Realize that there are loving individuals with smiling faces much closer
than you think; that is why we have mandatory passwords. I suggest
that you use the given tools to protect yourself, and let me be the one
with the negative experiences; your life will be much better.

I hope that this is taken with good heart as was intended.

Old Man


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h02.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,25023 seconds with 18 queries