Linux Directory System | Kernel Binding - directory

Linux has a distinct directory system such as /sys /usr /media /opt etc. I would like to know what part of linux kernel maps its self to the directory to listen to syscalls as all operation in linux is done using files?
If i have to change the directory system to include a directory like /foo by default, will I have to look into kernel or an image that runs on top of kernel?
In summary what part of the linux kernel code is responsible for binding with these directories?

Related

How would write ansible script to find if directory is mounted or not?

I need to check if a directory is mounted or not. I have checked on doc.ansible for help but they only have create or delete.
I am using visual code for ansible and vm for directory file.
Module setup returns a list of mounted filesystems "ansible_mounts". It is possible to test it
ansible remote-host -m setup

Udisk - Error creating mount point no such file or directory

I'm trying to automatically mount a USB drive on linux. With all default settings it works and the drive is mounted to /run/media/username/drivename.
I tried to change the default mount point to /media/drivename by following the guide linked here: https://wiki.archlinux.org/index.php/Udisks#Mount_to_/media_(udisks2)
I added the file /etc/udev/rules.d/99-udisks2.rules with the following contents:
# UDISKS_FILESYSTEM_SHARED
# ==1: mount filesystem to a shared directory (/media/VolumeName)
# ==0: mount filesystem to a private directory (/run/media/$USER/VolumeName)
# See udisks(8)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
I then rebooted my machine. Now every time I try to access the drive, I get the following error:
Unable to mount drivename
Error creating mount point '/media/drivename': No such file or directory
If I remove the file I created and reboot again, the drives are mounted to /run/media/username/drivename like normal, and I can access them fine.
I'm on Arch linux. Any help is appreciated! Thanks!
For anyone running into a similar issue, I simply created the /media folder and then rebooted and everything worked. Apparently udisks expected /media to already exist.
Put 99-udisks2.rules in /etc/udev/rules.d/
run mkdir /media (as sudo)
run reboot
Profit!

Nginx fails to create directories on Windows 10 with error: nginx: CreateFile()...failed

I need to find a way/setting to allow Nginx to run a .bat file that will create directories and files via a WINDOWS service; my OS is Windows 10.
Currently, our windows service fails to create directories and files with the following:
CreateFile()
"C:\someForlderName\build\distribution.\nginx/logs/error.log" failed
(3: The system cannot find the path specified)
Somehow Nginx doesn't have enough permissions to perform write-access operations like creating directories such as /logs/ and /temp/ within the /Nginx/ directory.
Anybody ran into this problem before?
I was facing the same problem, sharing the thing that worked for me.
Nginx is showing this error because... nginx didn't find the error.log file..
For that,
Go to you nginx folder where other folders like conf, docs, html etc are their as.
Create folder name logs, and in that folder create a file name error.logas.
see the right way in picture..
If your Nginx is at D:\nginx\nginx.exe, execute this to start nginx
D:\nginx\nginx.exe -c D:\nginx\conf\nginx.conf -p D:\nginx\
For Nginx on Windows, you need to execute nginx server related command from respective home directory where nginx configuration file is located.

SAS creating data sets in the /home directory

Is there any process by which SAS creates data sets(.sas7bdat extension) in the /home directory? we have both 9.3 and 9.4 installed on the unix server.
The programmers do not have access to the /home directory but there are some files which are being generated at this location without the knowledge of programmers.
Please Help.
This is the default output location for any shell commands run by those users on the server. All sorts of things will typically end up there if they mistype the occasional command. One way to change this so that SAS outputs these sorts of files to the work library instead is to run the following in a session on the server:
x "cd %sysfunc(pathname(work))";
E.g. suppose you have a command like this:
echo Hello > myfile.txt
Unless you run a cd command first, myfile.txt will be created in your home directory by default.

Which all processes are using shared library

I have a shared library(.so file) on UNIX.
I need to know what all running processes are using it.
Do unix provide any such utility/command?
You can inspect the contents of /proc/<pid>/maps to see which files are mapped into each process. You'll have to inspect every process, but that's easier than it sounds:
$ grep -l /lib/libnss_files-2.11.1.so /proc/*/maps
/proc/15620/maps
/proc/22439/maps
/proc/22682/maps
/proc/32057/maps
This only works on the Linux /proc filesystem, AFAIK.
A quick solution would be to use the lsof command
[root#host]# lsof /lib/libattr.so.1
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
gdm-binar 11442 root mem REG 8,6 30899 295010 /lib/libattr.so.1.1.0
gdm-binar 12195 root mem REG 8,6 30899 295010 /lib/libattr.so.1.1.0
This should work not only for .so files but any other files, dirs, mount points, etc.
N.B. lsof displays all processes that use a file, so there is a very remote possibility of a false positive if is a process that opens the *.so file but not actually use it. If this is an issue for you, then Marcelo's answer would be the way to go.
Do in all directories of interest
ldd * >ldd_output
vi ldd_output
Then look for the the library name, e.g. “aLib.so”. This shows all modules linked to e.g. "aLib.so"

Resources