Logging file/directory Access Permission in linux [closed] - linux

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
Is there any way in Linux(SUSE) to log the items below when one file or directory is accessed?
e.g.,
File_Name/Directory_Name Date_Time who Access_Permission
FileA 09/24/2015_08:12:17 UserA[all users] Execute
At 09/24/2015_08:12:17, FileA was accessed by UserA(permission group: all users) who execute the file.

You can use very cool application called sysdig It is made to do tasks that you described. It is highly configurable and can achieve a lot of things.
In you case you might need to play with parameters to achieve a diserid output. For the sake of simplicity will provide an example that partially achieves your goal. Image I want to watch folder /tmp:
1:
Start sysdig with required params:
sudo sysdig -p "%user.name %proc.name %fd.name" "evt.type=open and fd.name contains /tmp"
2:
Do some activity in specified folder:
vagrant#worker:/tmp$ touch qwerty
vagrant#worker:/tmp$ echo "aaa" >> qwerty
vagrant#worker:/tmp$ more qwerty
aaa
3:
Observe the result:
vagrant touch /tmp/qwerty
vagrant bash /tmp/qwerty
vagrant more /tmp/qwerty

Related

How to alias or rename a file on the fly 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 2 years ago.
Improve this question
I have the following challenge under Linux:
An application is writing a config-file "samename.cfg" into certain directories
I want to have the config-file named different for each directory
I do not want any file called "samename.cfg" written to the directories
I can not change it in the application
So I would like to have the application thinking that it accesses samename.cfg but in fact it reads and writes anothername.cfg. Symlink does not help, because then there still is a file called samename.cfg in every directory.
Anybody any idea?
Regards,
Axel
Try using a hard link instead of a soft link when using ln command (just remove the -s flag).
See ln man's page for more details.

Where do we have to put a linux command? [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 3 years ago.
Improve this question
I just coded a script in bash on Ubuntu but I don't know where I should put it...
I read I had to put it in /usr/bin in a tutorial but maybe it's better directly in /bin ?
This is the difference between both directories:
/bin
It contains commands that can be used by both the system administrator and the users, but which are necessary when other file systems are not mounted (for example, in single user mode). It can also contain commands that scripts use indirectly
/usr/bin/
This is the main directory of executable commands in the system.
Therefore, it will work on both, but you must establish what responsibility your script has.

Is there an easy way to deal with files with long filenames and long directory names 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
Suppose I have a directory on my disk that has the name: photos_with_my_friend_John_from_first_semester_of_my_graduation_year
Now each time I want to enter this directory I must write the following command:
cd photos_with_my_friend_John_from_first_semester_of_my_graduation_year
I am new to linux and for me it is very boring to write this whole name each time I want to deal with this directory or any other directory or file that has such a long name. So is there an alternative easy way to do this?
Most shells offer tab completion: You simply type cd phot and hit Tab, and it'll insert the rest for you (assuming the prefix is unique).
How about using wildcards? Say photos*John*graduation etc.?
You can create a symbolic link for ease of access:
ln -s long_file_name short_file_name
then you can use short_file_name as you wish.

-a option in `cp` command -- what does it do? [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
What does the -a option do in the cp command?
I thought that the -a does not preserve the structure of directories. But, I have never found a case where the structure of directories has been destroyed by the -a option.
is there such a case where the structure of directories has been destroyed by the -a option? Thanks.
-a means 3 things:
preserve timestamps, permissions, group, user (if you're running as root).
preserves symbolic links (no dereference)
recursive copy
read the man page, it has all info there
-a, --archive
same as -dR --preserve=all
To my understanding, it should recursively copy the directories while keeping all the attributes. In which case, it shouldn't be destroying the structure at all.
http://man7.org/linux/man-pages/man1/cp.1.html

Is it a bad idea to give a user sudo access to perl? [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 8 years ago.
Improve this question
Is it a bad idea to give a user sudo access to perl (or any programming language interpreter for that matter)
E.g., it lets the user do this:
sudo perl -e 'print `cat /etc/sudoers`'
when they can't just do a
cat /etc/sudoers
Or is there something I'm missing which can prevent this? (I'm assuming not...)
If you give sudo access to any interpreter (all programming languages and all shells) then that user can do anything he wants on the system. So yes, it is a very bad idea.
Similar bad ideas include giving sudo access to rm, mv, tee or any archiving program (like tar or zip).
This question is also not about programming but about system management and therefore better suited to e.g. SuperUser.

Resources