maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   root password (https://talk.maemo.org/showthread.php?t=67359)

javispedro 2010-12-24 03:22

Re: root password
 
Quote:

Originally Posted by DrWilken (Post 902965)
I see... I'm not sure this is something I would want to do, but the error message says that the 'su' binary isn't suid which can be solved by doing (as root - i.e. run 'sudo gainroot' or just 'root'):
Code:

chmod u+s /bin/su

Note: please check if you're not setting the suid bit on the entire busybox binary. (su might be a symlink to busybox)

If you are, then you will in trouble soon.

Suggestion: forget about everything said on this thread and just use "root" or "sudo gainroot".

shailesh 2010-12-24 03:34

Re: root password
 
Quote:

Originally Posted by javispedro (Post 903245)
Note: please check if you're not setting the suid bit on the entire busybox binary. (su might be a symlink to busybox)

If you are, then you will in trouble soon.

Suggestion: forget about everything said on this thread and just use "root" or "sudo gainroot".

i have rootsh installed. i was able to use sudo gainroot / root and both were working and still working.
the only extra thing done here is
i set the password for root
i set the password for user.
and executed this command as suggested:
chmod u+s /bin/su
pls let me know what sort of problems i may face?

DrWilken 2010-12-24 10:47

Re: root password
 
Quote:

Originally Posted by javispedro (Post 903245)
Note: please check if you're not setting the suid bit on the entire busybox binary. (su might be a symlink to busybox)

If you are, then you will in trouble soon.

Suggestion: forget about everything said on this thread and just use "root" or "sudo gainroot".

You're absolutely right... :) It IS a symlink to busybox:
Code:

N900:~$ ls -l /bin/su
lrwxrwxrwx 1 root root 7 2010-05-11 20:11 /bin/su -> busybox

In my defense, I did say "I'm not sure this is something I would want to do"... :)

To clean up the mess run this:
Code:

su -
chmod u-s /bin/su

And as said earlier as 'user' just type 'root' to become root (no password needed).

After this change You won't be able to use 'su -' anymore.

shailesh 2010-12-24 12:48

Re: root password
 
Quote:

Originally Posted by DrWilken (Post 903373)
You're absolutely right... :) It IS a symlink to busybox:
Code:

N900:~$ ls -l /bin/su
lrwxrwxrwx 1 root root 7 2010-05-11 20:11 /bin/su -> busybox

In my defense, I did say "I'm not sure this is something I would want to do"... :)

To clean up the mess run this:
Code:

su -
chmod u-s /bin/su

And as said earlier as 'user' just type 'root' to become root (no password needed).

After this change You won't be able to use 'su -' anymore.

Thanks alot.
i executed as suggested by you :
su -
chmod u-s /bin/su

Now i will try doing ssh which i was suppose to do yesterday. i will check and let you know.
Thanks for being patient with my queries and helping me out. :)

retsaw 2010-12-24 13:20

Re: root password
 
Quote:

Originally Posted by shailesh (Post 903244)
it was asking for a password (however it was not accepting the paasword) but now if i try to do sudo su -
it says
sorry, user user is not allowed to execute '/bin/su -' as root on Nokia-900.
i am pretty sure this wasnt the case earlier.
can u help me with this as well sir.

As I said before, it is sudo asking for your user password, so you must have entered your user password, it was accepted then sudo is telling you you don't have permission to run /bin/su.

To fix this you need to edit your /etc/sudoers file, it is dangerous to edit this file manually because if you don't do it properly sudo will complain and stop working, instead it is advisable to edit this with the command visudo (which will verify any changes you make for correctness before saving the new file), unfortunately visudo defaults to using the "vi" editor which isn't the easiest for a noob (but I like it).

For the fix:
- Become root using the command "root"
- Run "visudo"
- Switch vi to insert mode by pressing "i"
- Add either "user ALL=(ALL) /bin/su" to enable that specific command with sudo or "user ALL=(ALL) ALL" to enable all commands with sudo, and add it to the top of the file.
- Switch vi back to command mode by pressing "Esc"
- Save and quit vi by typing ":wq"

shailesh 2010-12-24 13:21

Re: root password
 
can u let me know how to make the directories, files & scripts appear in different color. coz its all showing in ame color.
is there any way to fix it?

udaychaitanya16 2010-12-24 13:30

Re: root password
 
please tell me how to set password for root or user.I mean to say if i type sudogainroot it should ask me the password i set.I saw it on UBUNTU but unable to do so on N900.

DrWilken 2010-12-24 13:32

Re: root password
 
Quote:

Originally Posted by retsaw (Post 903431)
As I said before, it is sudo asking for your user password, so you must have entered your user password, it was accepted then sudo is telling you you don't have permission to run /bin/su.

To fix this you need to edit your /etc/sudoers file, it is dangerous to edit this file manually because if you don't do it properly sudo will complain and stop working, instead it is advisable to edit this with the command visudo (which will verify any changes you make for correctness before saving the new file), unfortunately visudo defaults to using the "vi" editor which isn't the easiest for a noob (but I like it).

For the fix:
- Become root using the command "root"
- Run "visudo"
- Switch vi to insert mode by pressing "i"
- Add either "user ALL=(ALL) /bin/su" to enable that specific command with sudo or "user ALL=(ALL) ALL" to enable all commands with sudo, and add it to the top of the file.
- Switch vi back to command mode by pressing "Esc"
- Save and quit vi by typing ":wq"

Instead of messing directly in /etc/sudoers You can create a file in /etc/sudoers.d with just the settings You need... ;)

Like this:
Code:

echo "user ALL=(ALL) /bin/su" > /etc/sudoers.d/custom-user.sudoers
or this (same but for ALL commands):
Code:

echo "user ALL=(ALL) ALL" > /etc/sudoers.d/custom-user.sudoers
or without password:
Code:

echo "user ALL= NOPASSWD: ALL" > /etc/sudoers.d/custom-user.sudoers
(Again, run 'root' before to become root)

DrWilken 2010-12-24 13:35

Re: root password
 
Quote:

Originally Posted by udaychaitanya16 (Post 903436)
please tell me how to set password for root or user.I mean to say if i type sudogainroot it should ask me the password i set.I saw it on UBUNTU but unable to do so on N900.

Change to root:
Code:

root
Set password for user:
Code:

passwd user
or root:

Code:

passwd root
It still won't ask You for a password when You use 'sudo gainroot' or 'root' (which does the same thing. changes to root WITHOUT asking for a password). It's what the "rootsh" package is meant to do.

DrWilken 2010-12-24 13:39

Re: root password
 
Here's a guide for getting "Ubuntu-like sudo behaviour":

Create the new sudo rule:
Code:

root
echo "user ALL=(ALL) ALL" > /etc/sudoers.d/custom-user.sudoers
update-sudoers

Set user password:
Code:

passwd user
After this You can close the terminal and uninstall the rootsh package. Or just remove it using:
Code:

apt-get remove rootsh
Close the terminal and open a new one or exit out of the root shell using 'exit' or Ctrl-D.

To become root now type (enter Your 'user' password):
Code:

sudo su -
(Doing it this way there is no need to run sudo before commands if You've switched to root first)

Or if You just want to run a single command as root type (enter Your 'user' password):
Code:

sudo <command>
Oh, and Merry X-Mas BTW... :D


All times are GMT. The time now is 11:38.

vBulletin® Version 3.8.8