How to save files into an USB pendrive?

Friend!!

Some information:

1 >> Nextcloud installed by CasaOS is installed via Docker, I believe you have to upload the Nextcloud container with the Pendrive path

2 >> If the error continues, I advise you to add this pendrive to fstab with the correct group and permission. In my case, thatā€™s how it worked. I use my Nextcloud on a 6 TB External HD formatted with NTFS

3 >> Another point to note that ends up being a bit off topic is that often the version installed by CasaOS may not be the most current and may also be more limited, just like snap

For a smooth integration, a Linux FS is not that bad. It supports group settings and everything out of the box (and no limits to filesize, or they are extremely large)

If it is docker or snap or things like that, this is important to mention in the initial post because it can change a lot in how things work. I was supposing a plain Linux OS.

1 Like

This! However, to be able to offer specific help we would at least need to know which image CasaOS is using. It could be one of the official community images, the one from linuxserver.io, one that they have built by themselvesā€¦ etcā€¦

@Jobby You may also want to ask here: CasaOS - IceWhale Community Forum

Great if NTFS works for you, but since we are talking about a Linux system here, a Linux file system like ext4 is usually preferable, and switching to NTFS will not solve any problems OP is expiriencing, and in the worst case it might even create additional ones. :wink:

Yes, itā€™s true that one-click install scripts on NAS appliances are often outdated and/or poorly maintained, and therefore should not be used (no idea if this is the case with CasaOS), but thatā€™s probably not relevant to this specific issue either, since External Storage has been working with Nextcloud for years.

Yep, see my answer to #1.

Hi everybody and thank you all for your help.

Yes, I use CasaOS installed from here: https://casaos.io/ (curl -fsSL https://get.casaos.io | sudo bash) and inside CasaOS thereā€™s Nextcloud.

By the way, going in the terminal of Nextcloud I tried to update it with the commands:
apt-get update
apt-get upgrade

Despite the updates inserted, in the GUI admin overview of Nextcloud shows the version:
Nextcloud Hub 6 (27.1.3)

and thereā€™s an upgrade: Nextcloud 27.1.7

So I donā€™t know why it didnā€™t upgrade everything.

Maybe the issue is with CasaOS and not with Nextcloud.

Anyway, I thank you again and apologize to all for the difficulties about this. Just I am not expert about how create your own cloud but I would like to learn how to do it.

Ok. Head back to the terminal of your Nextcloud image and type:
cat /etc/lsb-release

Post the output here.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION=ā€œUbuntu 22.04.4 LTSā€

Maybe I have found the solution. Perhaps the problem wasnā€™t the permissions on the pendrive, but on the main data folder of Nextcloud.

About the USB pendrive look at these commands:
sudo chmod 777 /dev/sdb
sudo chown -R www-data:www-data /path/to/usb
sudo chmod a+rw /dev/sdb
sudo chmod -R a+rw /path/to/usb

Since the default data folder is: /var/www/html/data, after Nextcloud installed, should I run these commands below ?

sudo chmod 777 /var/www/html/data
sudo chown -R www:data-www-data /var/www/html/data
sudo chmod a+rw /var/www/html/data
sudo chmod -R a+rw /var/www/html/data

Or something else ?

I wouldnā€™t touch these permissions at all, these are the hardware resources and to give any user full permission to it, just donā€™t do it.

Yes, the mounted folder must be adjusted. The chmod is different for files and folders, that can be achieved with the find command:

sudo find /var/www/html/data -type d -exec chmod 750 {} ;
sudo find /var/www/html/data -type f -exec chmod 640 {} ;

Thank you

Looked like the correct syntax for Ubuntu was:

sudo find /var/www/html/data -type d -exec chmod 750 {} \;

Without the \ symbol it gave the error likeā€¦ find: missing argument for Ā«-execĀ»

Anyway with this: sudo find /var/www/html/data -type d -exec chmod 750 {} \; it gave an error like: find: ā€˜/var/www/html/dataā€™: File or directory not existing

After have installed Nextcloud, I tried to find the folder /var/www/html/data but I canā€™t find it.

What I have found is: /DATA/AppData/nextcloud/var/www/html where the host of Nextcloud is located.

The container in: /var/www/html

Should I run this down below instead ?

sudo find /DATA/AppData/nextcloud/var/www/html -type d -exec chmod 750 {} \;
sudo find /DATA/AppData/nextcloud/var/www/html -type f -exec chmod 640 {} \;

yes, you had the other location within the container before.

Iā€™m not expert with the containers, are the permission inside seen the same like outside? And the users available as well?

I donā€™t know if the permissions inside seen the same like outside.

Going through: /DATA/AppData/nextcloud/var/www/html the nextcloud folder (watching from /DATA/AppData/) has a lock.

Then, all other folders are normal.

Arrived here: /DATA/AppData/nextcloud/var/www/html all the contents have a lock except for a folder called ā€œdataā€ which has a lock and a X

/DATA

  • Owner: root
  • Access: Create and delete files
  • Group: root
  • Access: Access files
  • Others
  • Access: Access files

/DATA/AppData

  • Owner: root
  • Access: Create and delete files
  • Group: root
  • Access: Create and delete files
  • Others
  • Access: Create and delete files

/DATA/AppData/nextcloud

  • Owner: root
  • Access: Create and delete files
  • Group: root
  • Access: Access files
  • Others
  • Access: Access files

/DATA/AppData/nextcloud/var

  • Owner: root
  • Access: Create and delete files
  • Group: root
  • Access: Access files
  • Others
  • Access: Access files

/DATA/AppData/nextcloud/var/www

  • Owner: root
  • Access: Create and delete files
  • Group: root
  • Access: Access files
  • Others
  • Access: Access files

/DATA/AppData/nextcloud/var/html

  • Owner: www-data
  • Access: Create and delete files
  • Group: www-data
  • Access: Create and delete files
  • Others
  • Access: Create and delete files

Tell me if I can proceed with:

sudo find /DATA/AppData/nextcloud/var/www/html -type d -exec chmod 750 {} \;
sudo find /DATA/AppData/nextcloud/var/www/html -type f -exec chmod 640 {} \;

Or if changes need to be made

What did you mean about users ?
In Nextcloud thereā€™s the user when you install it on CasaOS.

Ok, I tried with:

sudo find /DATA/AppData/nextcloud/var/www/html -type d -exec chmod 750 {} ;
sudo find /DATA/AppData/nextcloud/var/www/html -type f -exec chmod 640 {} ;

Didnā€™t work

No, I mean the system user. Perhaps on the main system they belong all to root and there are other permission settings within the container (sorry, I donā€™t use containers and canā€™t really help you with that).
If you have a setup installed and it works, I suppose the settings then should be ok, and then you should be able to see if these settings are done on the main OS level, or within the container.

Perhaps someone with knowledge can help out here.

About system user, looks like there are two admin profiles. I am using one of them.

Here it looks so simple: https://youtu.be/pcAvknt53vs?si=g_4dy6d8MixVEINX

Anyway, thank you for all !

I never used this CasaOS, but if it is based on a Docker, then concept is the same: Mount Local folder from the Host machine to the Container and configure access to it.
You should be able to:

  1. Mount you pendrive to the container of Nextcloud. This is needed to give an access to data from restricted area (container) to the host machine. E.g. as on screenshot (from some Youtube video about CasaOS) it should be in an ā€œAppā€ Options / Volumes:
    ŠøŠ·Š¾Š±Ń€Š°Š¶ŠµŠ½ŠøŠµ
    So, put path to the folder in a Host (your pendrive) and some folder that you like (you can simply use the same one) to the Container. Probable you need to restart App to apply changes. Now after step 1 you should be able to see folder content under Nextcloud container.
    **Do not mount it under /var/www/html as per: https://github.com/nextcloud/docker/?tab=readme-ov-file#custom-volumes
  2. Please read about Persistent data here GitHub - nextcloud/docker: ā›“ Docker image of Nextcloud to not loose all your files if container was recreated / restarted.
  3. Basically we should be ready to go. In Nextcloud UI try to add folder that you specifyed in Container as local storage and check if it works.
1 Like

Finally! Thank you so much!!!

Before I tried to install Nextcloud AIO but I didnā€™t finish everything.

I installed CasaOS, then Nextcloud from the app.

Then through the command lsblk I have found where the pendrive is located.

Then I used these commands (some obscured for privacy reasons):

sudo chmod a+rw /dev/sdb
sudo chmod -R a+rw /path/to/pendrive
sudo chown -R www-data:www-data /path/to/pendrive

to give access to Nextcloud to interact with the pendrive.

After the installation of the Nextcloud app, Settings of the app:
Host: /path/to/pendrive
Container: /path/to/pendrive/folder

Then directly in the app, as data and archive I put the same path of the Container (which, strangely, is still empty).

The system installed things and folders directly here: /path/to/pendrive where is located also the folder of the administrator of Nextcloud.

I have verified with an image previously saved in a new folder, re-doing these commands:

sudo chmod a+rw /dev/sdb
sudo chmod -R a+rw /path/to/pendrive
sudo chown -R www-data:www-data /path/to/pendrive

because the pendrive after looked ā€œclosedā€ and inaccessible.

If there is anything to refine in the executed commands (for example: maybe this sudo chmod a+rw /dev/sdb and sudo chmod -R a+rw /path/to/pendrive is too risky for privacy), you can suggest me.

Iā€™ve seen it worked.

So thank you so much again! :man_bowing: :man_bowing: :man_bowing:

1 Like

Glad that is it works for you :blush:

Another AI-generated reply from you, this time on an already resolved issue, and with some religion thrown into the mix :roll_eyes:

Seriously, please stop spamming the forum with your AI-generated replies! If people want to ask ChatGPT, they can do so directly and donā€™t need you as a proxy.

Yeah ! Thank you again ! :bowing_man:

1 Like