I want to share a file...

I want to share a file…I have a file in VPS and I want to make an URL for it that anybody can access and get it in a regular webbrowsers that requires no password and other effort. any suggestions to help?

Never try that just like that, you’d most likely create a security risk. Your best option would be to install Nextcloud on your VPS and set it up. It allows you not only to share files by link, but also let the link expire. People with the link, only have access to the file/folder you share with them, as long as the link does not expire.

Hi
Drop the file in your ~/Public directory and run the python built-in simple http server, you will need to open port 8000 (or port of your choice) in the filrewall…


cd ~/Public
python -m SimpleHTTPServer 18080

In your web browser to test;

http://localhost:18080

Building on Malcolm’s suggestion and with respect to Knurpht’s concern about secuiry,

Practically every programming language can deploy a variety of small webservers on demand, and unlike Apache are typically uncomplicated. Although I wouldn’t trust these webservers for high high volume and load, they’re typically more than capabile of serving maybe 5-10 simultaneous connections. But, from time to time I have run into these webservers used even in high traffic Production eeployments, the main thing to keep in mind is that these script-based webservers typically create a new User session for each request so number of Users puts a very small load on the system. Compare to Apache for example which requires sessions to Users and backends to be specified, and those resources reserved.

Since one of my favorite coding languages is javascript, I prefer to deploy javascript based webservers and NodeJS is server-side Javascript. And if you wanted to deploy a little website on NodeJS, you might consider a Static Site Generator which is what people are expected to do when they deploy to Github, Gitlab, et al.

https://en.opensuse.org/User:Tsu2/NodeJs_http_servers

But you’ll find the same in all other coding languages… like Ruby.
And, of course if you wanted to deploy a full-blown script-based webserver you would want to deploy Nginx, perhaps the most used webserver engine on the Internet.

Lastly, although security is the eye of the beholder, as long as the location you expose by your webserver is read-only, IMO your risk is likely minimal. Although I haven’t studied using these little webservers in Production that much, they’re so simple that it’s hard to think that such limited functionality would be a significant risk (and now I suppose someone will prove me wrong)

TSU

Try ‘yast2 http-server’. Click OK until done. Service installed uses few resources only, is reliable and absolutely maintenance free since several years:

erlangen:~ # systemctl status apache
● apache2.service - The Apache Webserver
   Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-10-23 20:19:15 CEST; 13h ago
 Main PID: 789 (httpd-prefork)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
    Tasks: 7
   Memory: 25.9M
   CGroup: /system.slice/apache2.service
           ├─  789 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache>
           ├─  866 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache>
           ├─  867 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache>
           ├─  868 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache>
           ├─  870 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache>
           ├─  871 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache>
           └─10999 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache>

Oct 23 20:19:14 erlangen systemd[1]: Starting The Apache Webserver...
Oct 23 20:19:15 erlangen systemd[1]: Started The Apache Webserver.

Configuration is as easy as could be:

erlangen:~ # cat /etc/apache2/conf.d/Albums.conf

# location of local albums
Alias "/Albums" "/home/Albums/jAlbums/"

# grant access 
<Directory "/home/Albums/jAlbums/">
    Require all granted
    Options Indexes FollowSymLinks
</Directory>
erlangen:~ #