====== Cloud Commander ======
[[http://cloudcmd.io/|CloudCommander]] is an amazing web-based file manager for your server files. It is a good replacement for [[services:filebrowser|FileBrowser]] since it's much more capable and has way less quirks, even if the UI is a little bit more //old-style//.
===== Installation =====
Create a standard user to host the CloudCommander installation. You will most probably //never// run it as this user, but always as different users, to allow it manage files owned by those users.
useradd -d /data/daemons/cloudcmd -m cloudcmd
See [[gentoo:npm|Using npm on Gentoo]] on how to setup your non-root user environment to use npm.
Then, install CloudCommander:
su - cloudcmd
npm i cloudcmd -g
You might want to set this in the user **.bashrc** in case you want to give write permissions to users in a specific group to the files managed by CloudCommander:
export UMASK=0002
===== Reverse Proxy =====
Running CloudCommander behind NGINX is easy, this is an example:
location /cloudcmd/ {
client_max_body_size 512M;
proxy_pass http://127.0.0.1:3002;
proxy_http_version 1.1;
proxy_set_header Connection $http_connection;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Remember to set the correct port as each instance of CloudCommander will have to run with it's own port, and set a reasonable location URL.
===== Running =====
You can run it by hand with the following example line:
cloudcmd --packer zip --root /data/shares/common --prefix /common --port 5005 --confirm-copy --confirm-move --no-auth --no-config-auth --no-contact --vim --no-dropbox --name "Common Share"
Or you can automate it...
I assume you want to run it as user **myuser**.
As the starting script, since i use OpenRC, i have written the following init script wihch needs to be dropped to **/etc/init.d/cloudcmd**:
#!/sbin/openrc-run
# Copyright 2024 Willy Garidol
# Distributed under the terms of the GNU General Public License v3
depend() {
need localmount net
}
CC_SLOT="${SVCNAME#cloudcmd.}"
CC_USER=${USER:-${CC_SLOT}}
CC_GROUP=${GROUP:-${CC_SLOT}}
CC_PACKER=${PACKER:-zip}
description=${DESCRIPTION:-Cloud based filebrowser}
pidfile="/run/${RC_SVCNAME}.pid"
command_background=true
command="/data/daemons/filebrowser/.npm_install/bin/cloudcmd"
command_args="--packer ${CC_PACKER} --root \"${FOLDER}\" --prefix ${BASE_URL} --port ${PORT} --confirm-copy --confirm-move --no-auth --no-config-auth --no-contact --vim --no-dropbox --name \“${DESCRIPTION}\”"
command_user="${CC_USER}:${CC_GROUP}"
start_pre() {
if [ "${CC_SLOT}" = "cloudcmd" ]
then
ebegin "Error: do not run this script, run a link to it!"
eend 255
fi
}
make it executable!
Now, create a file **/etc/conf.d/cloudcmd.myshare**:
BASE_URL="/files/MyFiles"
DESCRIPTION="Common web archive"
FOLDER="/data/MyFiles"
GROUP="users"
PORT=3005
USER="filebrowser"
PACKER="zip" # or "tar"
And create the symlink, start it and add to autostart:
ln -s /etc/init.d/cloudcmd /etc/init.d/cloudcmd.myshare
rc-update add cloudcmd.myshare default
/etc/init.d/cloudcmd.myshare start
To add more shares, just create new links to the //cloudcmd// init script and create the associated config file.
==== Updates ====
npm u cloudcmd