Nextcloudpi - SSH Enable not working Probably

Just installed the latest NextcloudPi Img from Release Various fixes · nextcloud/nextcloudpi · GitHub for the Raspberry Pi.
Worked like intendet, done the activating Process and tried to enable SSH →

[ SSH ] (Thu Sep 29 10:21:07 BST 2022)
New password: Retype new password: passwd: password updated successfully
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
SSH enabled
(From the Nextcloud Pi Config Web intreface)

Connecting with SSH Client worked and was forced to change Password, after changing Password, was forced to logout and log back in:

NextCloudPi v1.50.1 is up to date
Last login: Thu Sep 29 09:38:08 2022 from 192.168.20.6
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for pi.
Current password:
New password:
Retype new password:
The password has not been changed.
New password:
Retype new password:
passwd: password updated successfully

When loggin back in:
NextCloudPi v1.50.1 is up to date
Last login: Thu Sep 29 09:38:44 2022 from 192.168.20.6
This account is currently not available.

What can i do to enable/use SSH on my NextcloudPi?

I think I have exactly the same problem…

  • I activate SSH and set a new password for the user “pi” in the NextcloudPi Panel
  • I then log in via SSH
  • There I get the message: “You are required to change your password immediately (administrator enforced).”
  • I change my password
  • when logging in with the new password I get the message: “This account is currently not available.”

The Image I downloaded is yesterday´s release (https://github.com/nextcloud/nextcloudpi/releases/download/v1.50.1/NextCloudPi_RaspberryPi_v1.50.1.zip)

[Edit]
I found a micro-HDMI-cable and tried to log in directly, even that did not work. The output I get after logging in is - just like when connecting via SSH:

This account is currently not available.

However the login attempts (both direct and SSH) seem to count as logins, the “last login” counts them.

1 Like

Problem solved! The pi-Account in /etc/passwd had “/bin/nologin”. To make it work

  • Mount the SD-Card from your pi on a Linux-System
  • edit the file /etc/passwd
  • for the user “pi” replace “/bin/nologin” with “/bin/bash”
1 Like

Hey @haukew,

Glad you got it to work. The (imo) better solution is, to use the ncp user :slight_smile:
But I agree that this should be fixed

2 Likes

What do you exactly mean be “to use the ncp user”, @theCalcaholic? How does this help me to access SSH? I actually tried to connect via ssh ncp@my.local.ip.adress but it gives me the same error message… and unfortunately I dont have another LINUX system via which I could edit the file mentioned by @haukew:frowning:

Hmmm…Maybe try a Linux in a VM via VirtualBox? @Pico

@Nils_Seegerer @haukew @Pico A fix is now in master. If you run a update via the web UI and then reapply the SSH settings, you should be able to access your instance via ssh.

There’ll soon be a new release with the fix as well.

3 Likes

Great - thanks a lot!

I have a new version of: NextCloudPi v1.51.0 is up to date

I’ve tried to set up ssh for pi user. I got error: ‘pi user does not exists’.
I’ve tried to set up ssh for ncp user. It was OK, but after first login to ssh and password change I cannot log in anymore:

Last login: Wed Jan 25 07:20:48 2023 from 192.168.12.104
Could not chdir to home directory /nonexistent: No such file or directory
This account is currently not available.
Connection to 192.168.12.109 closed.

I’ve exactly the same issue.
Setting up ssh for rootisn’t allowed, because insecure.
Setting up ssh for pigives error user does not exists. Trying other / normal usernames gives also this error.
I succeeded also to set up ssh for ncp, when ssh into it, change of password, but afterwards same issue.

I did what @haukew described:

  • mount sd-card in my laptop
  • edit /etc/passwd
  • replaced for user ncp /nonexistant with /home/ncp and /bin/nologin with /bin/bash
  • added directory /home/ncp

I just succeeded ssh-ing into my device!

Hello,

Can someone explain what the purpose is to change the root user shell to nologin ?
Then you can’t manage your server doing this.

Is that a bug or bullshit ?

To answer your question it is neither a bug nor bullshit.
It was made on purpose ;).
You can activate a user with ssh access in the webui.

oh yes, cutting access to root is a great idea. Mainly when the activation of ssh for root don’t work because of moving shell from /bin/bash to /sbin/nologin.
If you don’t want to let access to root by ssh, a better way is to change the permissions for root on ssh. with /sbin/nologin in case of crash you neither can’t access to the console.
You can’t add disks to the system in cas of lack of space for exemple. Great idea !

Cool, Looks like you have knowledge in that area.
If you have a better idea than the current let us know by making a pull request:
https://github.com/nextcloud/nextcloudpi/pulls

I’m not a develloper, but an administrator.
Disabling root with /sbin/nologin is a nonsense since you no longer can access your system as root.
Connecting with another user don’t let you do some admin work. even sudoing don’t work. you should change the sshd_config from this “#PermitRootLogin yes”
to “PermitRootLogin no” or better “PermitRootLogin prohibit-password”.
Disabling root the way you did don’t let administrators to do theyre job. And in case of crash, you have no more solution because you can’t access console either.
I tried to give ssh access to root via the webui. it don’t work.
Luckily, I didn’t try to install nexcloud with another application already in production, it would be very problematic

1 Like

Ran an update in GUI as you suggested. BTW SSH is still broke. Initinal SSH login keeps asking to change password. Change ncp password. Relaunch ssh and it just drops the connection.