Nextcloud - running occ inside pod shell

bogdansrb

Cadet
Joined
Sep 23, 2022
Messages
3
I have a truecharts nextcloud installation and I need to run the occ command inside the pod shell. The problems that I have are:
- I can't find the folder where nextcloud is installed (there's no /var/www or something like that)
- I can't login as www-data; when I run su -m www-data -c 'php occ files:scan' it asks for password
- when I open the pod shell with /bin/bash the shell user that I get is <I have no name!@nextcloud-postgresql-0> and indeed in /etc/passwd there's a "nobody" user
 

Heavy

Explorer
Joined
Aug 12, 2021
Messages
57
1666841213957.png

1666841248141.png


You can login as www-data with the two choices, The normal Nextcloud pod, and then the hpb container. After that your commands should run just fine.

It looks like you were trying to run the commands in the postgres shell.
 

LV52

Dabbler
Joined
Oct 14, 2022
Messages
10
View attachment 59521
View attachment 59522

You can login as www-data with the two choices, The normal Nextcloud pod, and then the hpb container. After that your commands should run just fine.

It looks like you were trying to run the commands in the postgres shell.
Hi, I have serval account in my old nextcloud, after i installed a new nextcloud, i copied the old "data" folder to new nextcloud path. Then i used the command of "php occ files:scan --all", my root account data were restore. But the other accounts in old nextcloud still miss, the other accounts data folder already in new account path. Do you have any idea? Thanks!
 
Last edited:

Heavy

Explorer
Joined
Aug 12, 2021
Messages
57
Hi, I have serval account in my old nextcloud, after i installed a new nextcloud, i copied the old "data" folder to new nextcloud path. Then i used the command of "php occ files:scan --all", my root account data were restore. But the other accounts in old nextcloud still miss, the other accounts data folder already in new account path. Do you have any idea? Thanks!
Maybe just check permissions. That'd be my guess. Also ensure the occ command is working correctly. Other than that I don't know.
 

victort

Guru
Joined
Dec 31, 2021
Messages
952
You either need to restore the database from the old Nextcloud instance, or use this workaround.

1. Rename all the user folders by adding a random letter or number to the end. For example if you had bob, then name it bob1 or something. This is because it won’t let you create a new user if there is already a folder with that username.

2. Create new users using the old names that you had before. For example, create a new user named bob.

3. Rename the folders back to original names.

4. Scan files again.

This works for me although it means new users and new passwords. But if you don’t have your database, there really is no other option.
 

indivision

Guru
Joined
Jan 4, 2013
Messages
806
Thank you! That worked.

It depends on exactly what you're needing to do. But, there is also a very easy way to run occ commands from within Nextcloud itself.

I forget the exact name. But, there is a one-click install app available within Nextcloud that gives you a terminal for running those commands.
 

victort

Guru
Joined
Dec 31, 2021
Messages
952
It depends on exactly what you're needing to do. But, there is also a very easy way to run occ commands from within Nextcloud itself.

I forget the exact name. But, there is a one-click install app available within Nextcloud that gives you a terminal for running those commands.
OCC Web

It says you need Nextcloud version 23 though. I haven’t tried with 24, 25, or 26.
 

indivision

Guru
Joined
Jan 4, 2013
Messages
806
OCC Web

It says you need Nextcloud version 23 though. I haven’t tried with 24, 25, or 26.

Yeah. There could be some version mismatch issues in some cases.

I'm using it on 25.0.2 currently.
 

Fjeld

Cadet
Joined
Dec 17, 2020
Messages
3
You can also go into shell as described above. (version 27.1.3)

And enter like this: (Change the command to what you would like)

su
su -m www-data -c "php /var/www/html/occ files:scan --all"
 
Top