maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   linux noob requires help with openssh (https://talk.maemo.org/showthread.php?t=36998)

fatalsaint 2009-12-18 18:46

Re: linux noob requires help with openssh
 
You need either a separate user with a password, or to set a password for the user "user".

You can either do this:
Quote:

sudo gainroot
passwd user
<set password>
or

Quote:

sudo gainroot
useradd -m ssh_user
passwd ssh_user
<set password>
(I can't guarantee useradd is on the system - could be adduser, or maybe have to do it by hand.)

Also, since you said you were going to look into keys, I recommend setting:

PasswordAuthentication no

in your sshd config as well. Then you can only use keys.

blubbi 2009-12-18 18:50

Re: linux noob requires help with openssh
 
Just use keys...

new users are added with:
Code:

useradd -m -N bla
passwd bla

Cheers
Bjoern

Dave999 2009-12-18 18:54

Re: linux noob requires help with openssh
 
ok. thx meanwile.

created new user and password, will user have same permissions as root.

If i change this to no, can't log in whith root anymore. but can user change it back to yes

PermitRootLogin no

but if stop shh. noone can connect to the phone so that should also be pretty secure?

fatalsaint 2009-12-18 18:55

Re: linux noob requires help with openssh
 
No. User will be a normal user with no privileges. You will probably need to add the new user to /etc/sudoers (best to use the command visudo if available) in order to sudo gainroot... or if your root user has a password (which I believe it does since you are using it to login via SSH) then you can just run:
Code:

su -
<root password>

as the new user and become "super user", ala Root.

edit: (root can of course change it back once you get root privs, but the user itself will not be able to change it back).

blubbi 2009-12-18 18:56

Re: linux noob requires help with openssh
 
Well just think about it...

You changed it once and you can change it in the same way with a new user (don't know if for "sudo gainroot" the user has to be in the "wheel" group or if you must add it to "sudoers")

Just for clarification:

To successfully use "su -" the user has to be in the group wheel (see "usermod --help" how to add a user to a groupe) but there is no group wheel so I guess this will not work. (If it was supposed to work that way, we would not need "sudo gainroot")

To run "sudo" the user has to be configured in /etc/sudoers.

Cheers
Bjoern

z3phyr 2009-12-19 06:23

Re: linux noob requires help with openssh
 
Quote:

Originally Posted by rambo (Post 425587)
1. get root terminal (open terminal, type "root")
2. run command "update-rc.d -f remove ssh"

To start/stop the SSH server in root shell use command "/etc/init.d/ssh start" or "/etc/init.d/ssh stop"



No, you should be able to get a root shell by simply typing "root" in the terminal.



I don't think so, not that it matters much upon next install it will probably prompt you for a new one anyway.

kwotski was faster than me: but the update-rc.d is in general the recommended way to muck around with the rc.d directories.

how come i cant stop and start the server anymore. it worked the first time, it would say ssh stop/start when i put in the command

now it says nothing and i cant stop the server

blubbi 2009-12-19 14:32

Re: linux noob requires help with openssh
 
Have you ever heard of "ps"? No, not Hores power!

Check for running sshd services with "ps -ef | grep sshd"

Second, if you run a command, let us know what EXACTLY you did and what EXACTLY the system returned.

Third what do you EXACTLY want to achieve? In most cases there is more than one way to do it.

When something does not work, try to run the program in debug mode and force it NOT to detach and NOT to become a Daemon.
For sshd this would be "sshd -d -f /path/to/configfile"

This means for you:
- Check for running sshd daemons -> kill them
- This one is not required, but makes things easier for us: restart your phone
- Read this: http://wiki.maemo.org/Root_access
- Run sshd in debug mode (see above)
- Try what you want to
- Tell us what you Exactly did
- Tell us exactly how the system responded to your input.

Cheers
Bjoern

krk969 2010-01-06 15:09

Re: linux noob requires help with openssh
 
Quote:

Originally Posted by blubbi (Post 432800)
Hey, why not use keys to authenticate...
.....

And just another hint for those who can't get a connection to there device when connected to the Internet via GPRS/UMTS.
Some providers do NAT, so the IP address the phone gets assigned is a none routeable address and thus you will not be able to connect to your device. Use some sort of VPN (OpenVPN) to get rid of that nasty problem.

Cheers
Bjoern

could Bjoern/anybody elaborate on it a bit more please.
Im trying to ssh into my N900 over a GPRS/3G connection and I cant seem to do it using the IP address asscoiated with the gprs0 interface.

cheers

blubbi 2010-01-06 15:46

Re: linux noob requires help with openssh
 
Quote:

Originally Posted by krk969 (Post 455629)
could Bjoern/anybody elaborate on it a bit more please.
Im trying to ssh into my N900 over a GPRS/3G connection and I cant seem to do it using the IP address asscoiated with the gprs0 interface.

cheers

Please make sure you IP is a valid one and not a private IP wich will not be routed:

According to RFC 1918, the following IP networks are for private nets which will never be connected to the Internet:

10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

If your gprs0 IP falls into one of those three ranges, your only hope to ssh into your phone is via a VPN connection (OpenVPN)

Cheers
Bjoern

krk969 2010-01-08 08:10

Re: linux noob requires help with openssh
 
Quote:

Originally Posted by blubbi (Post 455673)
Please make sure you IP is a valid one and not a private IP wich will not be routed:
...
If your gprs0 IP falls into one of those three ranges, your only hope to ssh into your phone is via a VPN connection (OpenVPN)

Cheers
Bjoern

Hi,

Yes my IP on gprs0 interface is private.
in the 10.0.0.0 - 10.255.255.255 range

Could you please elaborate how to use openVPN to connect via ssh on a GPRS connections.
Ive never used the openVPN .

cheers

blubbi 2010-01-08 13:11

Re: linux noob requires help with openssh
 
Quote:

Originally Posted by krk969 (Post 458780)
Hi,

Yes my IP on gprs0 interface is private.
in the 10.0.0.0 - 10.255.255.255 range

Could you please elaborate how to use openVPN to connect via ssh on a GPRS connections.
Ive never used the openVPN .

cheers

There are enough articles which describe how a VPN works, so I describe it very short.
  • You need a server which has a VPN (OpenVPN) daemon running and is accessible for all clients.
  • Your client (N900) connects to this server.
  • Your PC, from which you want to connect to the client, connects to the server. (Actually your PC can also be the VPN-Server, then this step is obsolete)
  • The server assigns every connected client an itself a private IP and establishes a Virtual Private Network (VPN) between all the connected clients
  • Within this VPN all clients can communicate with each other, regardless how they are hooked up to the Internet.

There might be firewalls which prohibit a VPN connection.

OpenVPN is available for Maemo:
http://maemo.org/downloads/product/Maemo5/openvpn
http://maemo.org/downloads/product/M...openvpn-applet

How to generate keys and set up your configuration:
http://openvpn.net/index.php/open-so...howto.html#pki

Please get some basic knowledge about OpenVPN and try to create your own client/server config based on the example here:
http://openvpn.net/index.php/open-so...to.html#server
http://openvpn.net/index.php/open-so...to.html#client

If you do not have access to a own Server, here's a list of VPN providers (make sure they provide OpenVPN):
http://filesharefreak.com/2008/10/18...ice-providers/

If you own a Fritz!Box (With Freetz Mod) or a router which can provide OpenVPN service you can use it in connection with a dynamic DNS service such as http://dyndns.com (your router should of course support the dynamic DNS service) to work around the fact, that most ISPs don't assign static IPs.

Another home brew solution would be a Server behind the router which provides the OpenVPN service and configure the router to send all the traffic on the VPN Port directly to the Server. Again, dynamic DNS service is required when you don't have a static IP.

I guess you'll find find one of the above solutions to fit your needs.

Cheers
Bjoern

eduperez 2010-07-03 02:13

Re: linux noob requires help with openssh
 
Quote:

Originally Posted by kwotski (Post 425610)
Don't do this! But, in the file /etc/passwd you'll see a line like:

root:OmfGcryptedpwWTF:0:0:root:/root:/bin/sh

If you change the bit I've put as OmfGcryptedpwWTF to just ! then root is in the same state as user once you save the file - no password is set and login is disabled

....
2) I don't know for sure that there wasn't already a default root password set on the device, rather than a ! - I didn't look at mine before setting the password
...

Yes, there is, just reflashed mine. So there IS a root password?


All times are GMT. The time now is 10:01.

vBulletin® Version 3.8.8