Change username admin NCP

Hi, I wanted to know if it is possible to change the NCP username in nextcloudpi. I found a guide to change only the password, but is it possible to change the username too? Thanks!

Afaik there is no command to change a username in Linux.

pretty sure you can just change it in /etc/passwd / /etc/groups / /etc/shadow but do so at your own risk

Hi nachoparker,

tried that with NCP docker version inside the container without success. There is no (known to me) editor like vi or nano. When I try trough the host I get a “Couldn’t open file” or so (chmoded to 777 temporary for sure). For security reasons I want at least to change the ncp name for NC. When I connect it to the world, it is to easy for the scanners, when the username is known to the public. Want to use a scrambled one, so they have to guess the username, then the pw…

How can I succeed? Any ideas?

TIA

Hi, did you manage to find any solution to the ncp change?
Security, for sure is an issue

Hi,

not yet, but I’ve enabled 2FA for all users.

But till now I noticed that the NCP container behaves more like a virtual machine. It has a lot of stuff inside and even apt. So I will install an editor and will try inside the container again. Then the files to change should open.

Yehaaaw, Just did.
Just for the records, change a username in Linux can be done with the “usermod -l” command. But this said, it cannot open /etc/shadow
So I installed nano in the container and started editing the usual files mentioned above by nachoparker. But even after restarting docker service there was no login possible, only when I changed back to “ncp”.

Then I noticed it is Apache asking for authentication. As I dealed with Apaches basic auth already, I searched around and found /etc/apache2/sites-enabled/ncp.conf

Inside you can see that the site uses external pw auth, which sounds OK, but near the end you will find “Require user ncp”, which is the OS user who will be allowed to sign in to the admin panel.

Change this to the same user you changed your OS ncp user too.

To restart apache2 inside the container I restarted the docker service on the host/pi. And now everything fits.

I can logon to the admin panel (which has unfortunately NO 2FA possibility) with my changed ncp user.

Additionally I didn’t expose 4443 to the internet.

Have fun. Also at your own risk.