Why does one command need sudo but the other one doesn't with the same permissions [closed] - linux

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 days ago.
Improve this question
I have the bzcat command with the following permissions:
-rwxr-xr-x 3 root root 39144 Sep 5 2019 /bin/bzcat
I have the bzmore command with the following permissions:
-rwxr-xr-x 1 root root 1297 Sep 5 2019 /bin/bzmore
And I have a bz2 zip file:
-r-------- 1 root root 61 Feb 17 14:37 flag.bz2
When I use bzmore flag.bz2 it works fine. But when I use bzcat flag.bz2 I get Can't open input file flag.bz2: Permission denied.. Why is this? If I put sudo in front of bzcat it works fine too but why doesn't bzmore need this when they both have the same permissions.
I tried running all the commands to test out what happened.

Related

Soft Link redirection in linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have created a soft link as follows:
/bip/etl>ln -s /bip/etl bipet
And now can see the soft link being created as well..
/bip/etl>ls -lrt |tail
-rw-rw-rw- 1 cdtbipx cduserg 24988174 Jun 19 19:17 227015716_WLR3PSTN_Filtered_06202016_5of6.csv.gz.gpg
-rw-rw-rw- 1 cdtbipx cduserg 23857587 Jun 19 19:17 227015716_WLR3PSTN_Filtered_06202016_6of6.csv.gz.gpg
drwxrwxrwx 1082 prod release 61440 Jul 3 02:51 WSC
drwxrwxrwx 5 oracle oinstall 4096 Jul 4 01:22 dsl
lrwxrwxrwx 1 cdtbipx cduserg 8 Jul 4 08:43 bipet -> /bip/etl
However, I cannot refer to the soft link bipet while I try to search a specific file in the concerned folder.
ls -lrt /bipetl/227015716_WLR3PSTN_Filtered_06202016_6of6.csv.gz.gpg
ls: /bipetl/227015716_WLR3PSTN_Filtered_06202016_6of6.csv.gz.gpg: No such file or directory
What am I doing wrong here?
You created a link bipet in directory /bip/etl (current working directory when you did ln).
You you should do:
ls -lrt /bip/etl/bipetl/227015716_WLR3PSTN_Filtered_06202016_6of6.csv.gz.gpg
Or create the link using (assuming you have privileges to write to the /):
ln -s /bip/etl /bipet
And then you can do:
ls -lrt /bipetl/227015716_WLR3PSTN_Filtered_06202016_6of6.csv.gz.gpg

Trouble running statrup script on Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I'm using the Amazon flavor of Linux
uname -a
Linux mydomain.org 3.19.25-82.99.amzn1.x86_64 #1 SMP Wed Dec 3 21:29:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
and I want to run the following script upon system reboot ...
ls -al /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh
-rwxr-xr-x 1 davea mycompany 2023 Nov 28 2011 /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh
So I created this file,
-rwxr-xr-x 1 root root 73 Dec 10 19:29 /etc/init.d/start_tomcat
with the lines
#!/bin/sh
sh /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh
However, when I reboot my system, this script isn't getting invoked. What steps have I left out? I can run the script fine at a command line when I'm logged in.
Edit: Also, I created this symlink in /etc/rc.d ...
ls -al /etc/rc.d/start_tomcat
lrwxrwxrwx 1 root root 24 Dec 10 19:29 /etc/rc.d/start_tomcat -> /etc/init.d/start_tomcat
Still no luck.
You have to add the start-up script under init.d to your default runlevel.
sudo update-rc.d /etc/init.d/start_tomcat defaults
Which should create symlinks to your script under the appropriate /etc/rc?.d folder(s).
This depends on which startup program is being used. Assuming you have privileges to do so, and if the star up program is the chkconfig program your etc/init.d/start script must follow suit in that you need such header fields like:
# chkconfig: <levels> <start> <stop>
# description: <some description>
For other programs, like systemctl (redhat/fedora) you'll need to create a file with directives in it in the following folder:
/etc/systemd/system/
You'd typically make a file called serviceName.service with the following entries:
[Unit]
Description=MyApp
[Service]
ExecStart=/path/to/myService/executable.sh
[Install]
WantedBy=multi-user.target
Then run:
sudo systemctl enable /etc/systemd/system/hello.service
sudo systemctl start hello.service
If this is a LSB (Linux Standards Based) OS/Startup you should follow the tutorial below:
https://wiki.debian.org/LSBInitScripts

Unknown users rights (-????????? ? ? ? ? ? myFile.php) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I have some weirds user rights on my files.
Log as user1, I have set user2 owner of the files. It did worked.
-rw-r-xr-x 1 user2 user2 21090 Jun 18 16:28 myFile.php
drw-r-xr-x 2 user2 user2 4096 Jun 18 16:30 font
But then, when I log with user2 I Have this weirds unknown rights.
-????????? ? ? ? ? ? myFile.php
d????????? ? ? ? ? ? font/
Top directory that contains these files has no "x" bit set.
chmod u=rwx test2/; ls -l test2
total 4
drwxr-xr-x 2 user group 4096 Jun 19 14:43 dir
-rw-r--r-- 1 user group 0 Jun 19 14:43 file
chmod u=rw test2/; ls -l test2
ls: cannot access test2/file: Permission denied
ls: cannot access test2/dir: Permission denied
total 0
d????????? ? ? ? ? ? dir
-????????? ? ? ? ? ? file
To fix this, please add "x" bit to following section of root directory. Usually "group" part is relevant but it might be "others" or "user" depending on your situation.
chmod g+x /path/to/directory
For further reading please consult http://www.linux.com/learn/tutorials/309527-understanding-linux-file-permissions

unable to change the permisson of an file in linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Unable to change the permission of the cgi-bin. I want that folder to have write option for user too
abc#abc:~/public_html> ls -l
total 12
drwxr-xr-x 2 root root 4096 2013-10-24 11:16 cgi-bin
-rw-r--r-- 1 john users 835 2013-10-24 15:54 index.html
when i write
abc#abc:~/public_html> chmod 770 cgi-bin
error:
chmod: changing permissions of `cgi-bin': Operation not permitted
you should use
sudo chmod 770 cgi-bin
or to recursively change all files in the folder
sudo chmod -R 770 cgi-bin
You can also use this
$ sudo chmod -R 777 dirpath/filename

Chown not working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
On Ubuntu 12.04, the chown command doesn't seem to be working like it should
root#server:/var/www/folder/# ls -al
Running this puts out
drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder
I need write permissions for the group, so I run:
chown -R 776 ./Other_Folder
Then when I run ls -al again, the output is still
drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder
chown is used to change ownership of the file, not change permissions.
ls -al is not showing you who owns the file, just its permissions.
If root owns those files, you'll need to chown them properly, before you can change their permissions:
chown -R yourname:yourname folderName
Then as the owner you can change their permissions:
chmod -R 776 folderName
Edit:
I double checked the syntax and it seems to be right, you'll likely need to use sudo to use them.

Resources