Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've rooted my Palm Pre (WebOS 1.4.5) and installed a SSH server on it. Now I'd like to SSH into it with an unprivileged user and use sudo for elevated commands.

However: There is no sudo on the system. Can I add it somehow?

share|improve this question
2  
why not just use su -c 'command'? –  xenoterracide Nov 7 '10 at 19:57
    
@xenoterracide: Because I have literally no idea about Linux. ;-) This is is a busybox based system, BTW. su tells me "su: must be suid to work properly". –  Tomalak Nov 7 '10 at 20:26
    
@tolomak, yeah it would have to be suid... do you have root access? can you chmod it? –  xenoterracide Nov 7 '10 at 23:26
2  
@xenoterracide, sure I can. I did a chmod 4755 /bin/su and su works now, thanks. :) I also found a way to install sudo itself, took me a while to get it right. –  Tomalak Nov 8 '10 at 8:50

1 Answer 1

up vote 5 down vote accepted

I found the way to do it (was rather easy after all):

  • prerequisite: Preware is installed (done this already)
  • install ipkg-opt (called the "Optware Advanced Linux Command Line Installer" in Preware)
  • connect to your device command line as root (via novaterm/USB cable or SSH, if already installed)
  • call ipkg-opt update
  • call ipkg-opt list | grep sudo to make sure the package is available
  • call ipkg-opt install sudo

At which point my device did:

palm-webos-device ipkg # ipkg-opt install sudo
Installing sudo (1.7.4.4-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/sudo_1.7.4.4-1_arm.ipk
Configuring sudo
Successfully terminated.

I assume an unpriviledged user has already been added to the system. Now modify /opt/etc/sudoers:

  • chmod 640 /opt/etc/sudoers (make writable for root)
  • add permission for that user to the file (username ALL=(ALL) ALL)
  • chmod 440 /opt/etc/sudoers (make readlony again)

Now SSHing into the device as the unprivileged user and using sudo from there should work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.