Where is the zipcloak puts the temporary file by default? - linux

When I use zipcloak to encrypt an existed zip file, I got an error like this:
zipcloak error: Permission denied
zipcloak error: Temporary file failure (ziC8mO6F)
The command I executed:
/usr/local/bin/zipcloak /Library/WebServer/foo.zip
I'm sure I've set the permission of /Library/WebServer to 777, but it seems like zipcloak create the temporary file in a different place.
By the way when I specify the temporary path by -b option of zipcloak, it's worked.
/usr/local/bin/zipcloak -b /Library/WebServer/ /Library/WebServer/foo.zip
The -b option:
-b Use the specified path for the temporary zip archive

It tries to open a temporary file in the current directory.

Related

Cannot create directory in tmp(overthewire bandit24)

I'm trying to solve bandit24 on overthe wire on ubuntu virtual machine.
I have already seen the solution.
But i have a problem,when i try to create a directory on tmp as bandit24#bandit i get this message:
Cannot create directory "name_of_directory": file exists.
If I try with find command there is only the "." directory and with ls I get the message:
Cannot open directory '.' : permission denied.
I also have tried with ls -l on tmp and I get the message:
Cannot open directory 'tmp': Permission denied
What else could I do?
What could be the problem?
Try to prepend sudo at your command. Seems you don't have permissions to read the /tmp directory, what is pretty weird.
Example that might works:
To list the /tmp contents:
sudo ls -l /tmp
To create the 'my_new_dir' inside /tmp:
sudo mkdir /tmp/my_new_dir
It means that there is a directory under /tmp/ with the same name that you specified. But since you did not create it (in this case, someone created with a different bandit user), you cannot view it. There is not read permission for bandit24 to access it.
Since /tmp/ is directory accessible for all user accounts, you cannot list the files/directories under it without the root permission. (Which means the root of the bandit machine has configured like that)
What you need to do
Try a random name. Create anything random under /tmp/. It will work.

rcs -u motd breaking a lock

I am trying to use the rcs command to break a lock on a file but whenever I input on ubuntu:
rcs -u motd
it says:
rcs: RCS/motd,v: no such file or directory.
The file is there because I can use the cat command and edit it using vi.
Try rlog motd, which should give you information from the file RCS/motd,v . If that also gives you "no such file or directory", then it's the file motd,v in the subdirectory RCS, which doesn't exist or you can't access.

How to output the non-readable contents of a directory in bash

In bash how would one output the non-readable contents of a directory?
For example, let's say the directory is ~/foo, and there's a non-readable folder ~/foo/folder with a file ~/foo/folder/file1.txt, and another non-readable file ~/foo/file2.txt. I want to output:
~/foo/folder cannot be read.
~/foo/folder/file1.txt cannot be read.
~/foo/file2.txt cannot be read.
If you cannot read folder ~/foo/folder, there's no way for you to detect any files in it, be they readable or not.
If you can read ~/foo, you can go over all files and directories and test, wether they are readable or not:
find ~/foo | while read file; do
if test \! -r "$file"; then
echo "$file cannot be read"
fi
done
Directory permissions are interesting. If you don't have read permission on a directory, you cannot find out which files it contains by a system call such as readdir() (which is how commands such as find, ls, and even the shell generate lists of file names).
If you have read permission on a directory, you can find a basic list of the files in the directory, but you need 'execute' permission to access the files, even to find out the file permissions.
If you have execute permission without read permission but you know the name of a file in the directory, you can both list the file and access it (if the file permissions give you permission to do so).
So, if the directory is not readable but you have execute permission on the directory, you can investigate any files you know about in the directory. You can't find out which files are there, though.

How to change the temprary directory for configure script?

When I run the configure script to build GNU global on Linux system, I got the message "cannot create temp file for here document: No space left on device". Indeed, / disk was full.
So I tried to change temporary directory to another disk, and I set the environment variable TMPDIR, TMP, and TEMP to another disk directory, say /mnt/tmp.
I retried to run configure script, but I got the same message. What's wrong? Please give me any advice.
Thanks.
you could add the below statement at the beginning of your script.
export TMPDIR='DIRNAME'
where "DIRNAME" is any directory on which you have full permissions and has sufficient memory available in it
you can override the location of the temporary directory during configure like so:
./configure TMPDIR=path/to/your/tmp/folder
If your / directory is full, and the program is trying to write to your /tmp directory, try renaming the tmp directory to something like tmp_old, then create a symbolic link to your new tmp folder like: ln -s /mnt/tmp /tmp

cannot create Regular file while copying from one system to another system

I tried to copy a file from one linux server to another Linux server using the below command
scp sampleweb.rar pavan#50.45.555.90 /
It gave me this error under putty console .
cp: cannot create regular file `/sampleweb.rar': Permission denied
cp: cannot create regular file `/pavan#50.45.555.90': Permission denied
Assuming you are trying to write to the / directory on the remote machine, it looks like you are missing a colon:
scp sampleweb.rar pavan#50.45.555.90:/
Without the colon, scp asssumes this is a local copy, and falls back to cp on the local machine, as indicated by your error messages.

Resources