I have access to a remote server over ssh. I have only read (no write) access on the server. There is a zipped log file that I want to read.
But because I have only read access, I cannot first extract the file and then read it, because when I try to unzip, I get the message Read-only file system
.
My idea was to redirect the output of the gunzip
-command to some other command that can read from the standrat input and display the content in the console. So I do not write the unzipped file on the file system (that I do not have the right) but display it directly in the console. Until now I couldn't successfully do it.
How to achieve this goal? And is there any better way to do it?
Since you do not have permission to unzip the file, you will first need to view the list of contents and their path. Once you get that then you can view content using
-p
option of unzip command.View contents
zipinfo your.zip
View file contents
unzip -p latest.zip wordpress/wp-config-sample.php
.gz
file then use:gunzip -c wordpress/wp-config-sample.php
Hope this helps!