Change permissions on Google Drive folder to work with Apache htdocs - google-drive-api

I want to use my Google Drive as a common place to store my websites that get run through apache. I downloaded the Google Drive client and copied my htdocs folder there. I then put a shortcut to this folder where the old htdocs would go. Now when I go to a development site I get greeted with an Access Forbidden! error. Is there a way to change the permissions on this folder or is the whole approach flawed?

The quick way around this is to chmod the folder you're trying to access and any dependencies inside it. I used 755 and recursively applied it to the files inside my project's www folder but you'll likely have to chmod the parent folder even further up using 755.
chmod 755 -R www
If you can't figure out where to apply the permissions changes to, you can read your Apache error logs. I use this command:
tail -f /var/log/apache2/error_log
That should get you sorted out.

Related

Is there a way to mount Google Drive on my local machine like what could be done in Colab?

In Colab, the following code snippet is used for mounting Google Drive.
from google.colab import drive
drive.mount('/test', force_remount=True)
And I'm wondering if it could work on my local machine. When implementing this locally, it says "no module named google", even after having executed pip install google.
Is there another package that should be installed, or it just cannot be achieved? I've searched for a while, but it seems that the only solution is to install Google Drive Desktop to give access to remote files.
Although google.colab python library can be found here, this library is a collection of tools meant to work in conjunction with the Google Colab product.
Indeed, Google Drive Desktop is your best option to "mount" your Google Drive to your local machine.
Alternatively, there are several 3rd party Google Drive clients available.
Use ocamlfuse.
Here are the step by step details: https://medium.com/#enthu.cutlet/how-to-mount-google-drive-on-linux-windows-systems-5ef4bff24288
Instead of mounting it to a home folder (named googledrive in tutorial), I suggest mounting it such that folder structure would be same for both colab and local machine. To do that:
create your mounting folder at root (it's not a recommended practice but there is no harm). You need to use sudo. i.e at /, use sudo mkdir test
then create MyDrive inside test.
Chnage test or MyDrive owner to yourself: sudo chown <your username> MyDrive/
Mount to MyDrive by: google-drive-ocamlfuse MyDrive/
Enjoy!

How to make PhpStorm access a proper directory?

I'm running Linux Mint. My existing projects are located at the /var/www/* folders. But when I'm trying to create a new project then the PhpStorm's file browser is not showing me that folder at all. Like there is just no /var/www folder, but I know it is there and is having a full access permissions (0777).
In addition it shows for example a folder /var/data/JetBrains which is not actually available in my system (terminal: cd /var/data - no such file or directory).
So it seems like it is showing some kind of its own /var folder (virtualized?), not the one that is actually in my system. How can I solve this problem, how can I make it so it use my system's /var folder?
Solved. Do not install the PhpStorm from the Mint's software manager. It comes there in some kind of wrapper that isolates the filesystem.

gsutil doesn't run in the mounted drive directory

I'm trying to run gsutil in the shared environment and I see a really weird behaviour.
When I run it being in the root of the filesystem, as well as anywhere else - everything is fine, but when I open the shared drive mounted directory it fails with this:
$: gsutil
cannot open path of the current working directory: Permission denied
The shared drive folder itself is the Google Fileshare NFS with drwxrwxr-x, and the user is in the group that can do rwx.
Any help appreciated, thanks!
update: The issue was in the snap way of the installation of the gcloud-sdk, I'm not sure the exact nature of the problem, but reinstalling it following the google-sdk istallation manual with apt-get solved the issue.

What is the equivalent of C:/ in mysql using linux?

I have this code but I can' figure out how to change the C:/ drive to an equivalent of linux. Below is the code:
SELECT * INTO OUTFILE 'C:/CountryLanguage.txt' FROM CountryLanuage;
I have tried doing '/student', '/home', '/usr', and just plain '/CountryLanguage' I am not sure what to do. Can someone please help me?
Thanks,
Well, this depends on where you would like to save the file.
If you would like to save it in for example "/student" you'll first have to create this folder in the root folder "/". Creating a folder is done by typing:
cd /
mkdir students
Once the directory is created you can make sure it's there by typing:
ls /
Which display all the files and folders in /.
ls /students
Displays all the files in the /students folder.
Since this is in the Linux root you'll have to change the permissions for the folder so that MySQL can write to it. This by typing:
chmod 777 /students
You shall only use 777 for testing since this allows everyone to read, write and execute in that folder but i advise using this to make sure it's not the permissions causing an error.
EDIT:
If you don't have root access to the system you should try saving your file to "/var/lib/mysql/" where MySQL can write.

Copy PDF file from Google drive to remote server

I've built nice browsing window which shows all of the pdf files on my (or any user) Google Drive for managing purposes.
What i looking to do is simple, i want to take a pdf file from my google drive (i have all the info related to this file - "downloadUrl","webContentLink" etc) and just copy it to my server (remote).
Any thoughts?
I guess I'm pretty late here, but this may help other people too.
You could try using Grive. Here's a straightforward tutorial: http://xmodulo.com/2013/05/how-to-sync-google-drive-from-the-command-line-on-linux.html
Even if you don't have root access on the server, you can simply build from source, and:
$ mkdir ~/google_drive
$ cd ~/google_drive
$ grive -a
You'll receive an auth URL which you need to paste on your browser and click on "Allow Access" and you're done. Go to the google_drive dir on your server and run grive to sync between your local dir and your GDrive.