On Tue, 22 Sep 2015 17:41:57 +0900
Joel Rees <joel.r...@gmail.com> wrote:

> I have this rule in doas.conf:
> 
>     permit nopass user1 as user2
> 
> As user1, I try this at the command line:
> 
>     doas -u user2 whoami
> 
> and it tells me I am user2, as I expect. And
> 
>    doas -u user2 ls
> 
> tells me I don't have permission. I kind of expect this.
> 
> I'm looking for a way to do the equivalent of
> 
>     sudo -u user2 -s "cd; ls"

My two slightly different solutions

$ doas -u user2 -s << EOF 
> cd /home/user2                                                                
>                          
> ls
> EOF

$ doas -u user2 env HOME=/home/user2 /bin/ksh << EOF                            
                         
> cd
> ls
> EOF

Greetings ben

Reply via email to