Can't seem to access OSMC via SSH, Samba or FTP

I’m trying to access the root of my OSMC installation to edit some files within an add-on, but for some reason I can’t seem to connect to it via any of the regular file sharing services which are running on it.

I can successfully ping the device and I know that it’s on my home network at the IP address I am trying to access it from, but my username/password in each case doesn’t seem to be valid… I get “invalid access credentials” trying to login via FTP, and a similar message trying to login via SSH (which I’ve tried through terminal on my Mac, as well as Putty on PC). 0SMC is also running a samba server, but whilst it Successfully shows up on my network as a samba device, I can’t seem to access anything outside of the “user documents” type folders, such as music, videos and downloads etc.

I haven’t changed my username or password since installing, so I am assuming they should still be ‘osmc’ for both, but this doesn’t seem to work via any connection. I’ve also followed advice on this forum suggesting I should try to change the password from command line before putting into OSMC, but I was not able to do this either (when I issued the change password command, it threw up an error and said something about an invalid access key or something…).

I’m reaching the end of my tether trying to get access to my device, and I’m worried that the next logical step might be to completely wipe my SD card and start again from scratch. I do have some backups saved, but I’d still rather avoid this course of action where possible as I’m never quite confident that everything will be successfully restored upon reinstallation.

Can anyone suggest any other methods of accessing my system, or reasons why my username/password might have stopped being accepted?

I would re-install, if you haven’t changed your password and the username ‘osmc’ and password ‘osmc’ aren’t being accepted then it sounds like someone else has changed that password for you, which isn’t good…at all.

When you reinstall make sure you log in via ssh right away and type passwd and choose a new password. Note that the samba (windows file sharing) password isn’t changed at the same time and this will remain as ‘osmc’ (I think)

Correct – but it can be set with smbpasswd

Wow… That’s kinda scary?! Who would be able to or even want to change my password? My raspberry pi is on my wired network at home so I would assume unless somebody hacked my Wi-Fi then it would be impossible… And I certainly haven’t noticed any other signs of unauthorised access.

Is it possible that something within OSMC could’ve corrupted and caused the username/password to be changed or rejected? Or anything else that could be causing this inability to login to my system, before I go all out crazy and format my entire installation?!

No one can say for certain but I’d chalk this up as a lesson learnt “don’t use default passwords” and then I’d reformat. At least using a non default password you’d be more confident no one hacked you.

It’s possible something corrupted via OSMC, no one could really say as the information we need you’re locked out from viewing.

Probably accidental port forwarding for another IP, DHCP gives IP to wrong device.

1 Like

Could you possibly explain this any more? Are you saying that the IP address I think is assigned to my Raspberry pi in fact is not? And if so, how can I check this/fix the problem?

You can find the IP (or set a static one so you’ll always know what it is) by going to “Settings”->“My OSMC”->“Network” from the normal front end. When you know what the IP address is retry the ssh command.

Oh I see, well in that case no, I’m definitely sure I’m typing the right IP address because as I said I can see the samba share and all shared folders on my Mac at that IP address, but I can’t access any of the root files that way…

What credentials are you using to access the samba share?

If you can take the SD card out of the RPi then you can add the following line to the end of the cmdline.txt to get the RPi to boot to a root shell:

init=/bin/sh

Then you can change the password by issuing:

passwd osmc and following the prompts.

Then delete the line from cmdline.txt and reboot - that should get you back in, but if you believe that the password was changed due to malicious activity I would strongly advise you to rebuild the system once you have recovered anything of value.

+1

Shift or CTRL can get you in to safe mode if held down while booting too (root shell)

That’s very useful to know :slight_smile:

Hey, thanks very much for this but I’ve actually already tried this on another forum’s suggestion; the issue is that when I type passwd osmc it tells me it couldn’t be changed. I forget exactly what the message was, and now I can’t seem to get it to boot to a command prompt to check…?! But my OSMC still boots absolutely fine… Seems like something is afoot, though…

UPDATE

So I backed up everything, formatted SD, reinstalled and can now SSH again. Weird. Will change password and keep an eye on it in case it happens again. Thanks all.

Try on your device

nano ~/.ssh/known_host

Delete the line that contains the IP address 192.168.1.101.

Then reconnect as before

'ssh osmc@192.168.1.101`

What’s happening here is that your computer has saved the unique key for the IP address, and because you’ve formatted the device a new key has been generated.

This message will happen every time you connect to a “different” device on the same IP.

Thanks - already got it and edited my post! :smiley: