Hello Ishwara,
There are several ways to upload/download/transfer files to VM instances on GCE. It depends on whether you are using Linux instances or Windows instances.
For Linux instances, use the gcloud command-line tool. The gcloud compute scp command obtains the necessary private SSH keys for you from the project and instance metadata and then uses the SCP tool to perform the file transfer.
For Window instances, you can use RDP client.
You can use Google Cloud Storage to transfer files between instances or your local computer. If you're creating many instances and uploading the same set of files to them, it would be easier to upload your files to a GCS bucket and then use 'gsutil cp' command in your script to automate the transferring the files to your VMs
Moreover, you can use the file browser on Linux or macOS workstations to transfer files. Similarly, you can use WinSCP for windows workstation.
You can use CAT command on SSH terminal to view a file on your VM.
There could be many reasons that you are not able to view or transfer the file and few of them are:
i.) You don’t have permission to access the file or drive
ii.) Wrong SSH keys
iii.) Wrong destination or source name or IP address in file transfer command.
Have you been using the sudo command?
You can either change the permission of the directory or change the ownership of directory with the sudo command in linux.
You can refer to this stack exchange discussion for further clarifications on permission denied issues.I think we lost the track here. Can you please clarify your objective here?
Initially, you asked about how to open and upload/download files from VM and I recommended you different ways of file transfer. Can you please confirm which option you are following and at which step you are getting an error message?
If a user requires root permissions, they can get those permissions by running commands using sudo. Please note that user has to use prefix “sudo” with every command to get elevated permissions.
As per one of my previous post (stack exchange discussion), you can refer the following command to change permission of the directories.
sudo chmod -R 777 /home/sixven/camp_sms/inputs
The following command to change ownership (and make user:francisco-vergara as the owner) of the directories. I would suggest changing the ownership of the directory since it is certainly more secure.
sudo chown -R francisco-vergara:francisco-vergara /home/sixven/camp_sms/inputs
I strongly suggest going through these steps for transferring files using WinSCP
To understand how GCE manages the ssh keys and how GCE manages the metadata, please go through this article about Google Cloud SSH Keys.Google Cloud Identity and Access Management allow users to create and manage permissions for GCP resources which include users project resources, GCE, GAE, API, cloud tasks, cloud trace etc. That being said, SSH keys created in your project, will let you access the VM, but you cannot change the permissions of the directory of the VM via the IAM console.
The purpose of instances-level SSH keys is to authentication users and initiate command line session with Linux instances. They used for specific instances only and it has no significance with respect to VM directories permissions or ownership. You can refer this link to manage ssh keys
When you SSH in a VM, Linux kernels are configured by default to show the user you have logged in. i.e.
username@instance_name
You can also verify the user you have logged in via traditional linux commands. I.e
username@instance_name:~$ who i am
username pts/0 2017-10-17 17:56
In that sense, I really do not believe there could be something wrong with the definition of the keys in your project. Instead I think your problem is related to the permissions in the VM. Nevertheless, if you feel there is something wrong in your project metadata, feel free to send me via a private message your project ID.