I have a running a fuse fs with options allow_other and umask 0. This gives me a set of files with permissions set to 777. Though when I try to ls -l in the directory containing the files I get the following output:
ls: name: Operation not permitted
ls: tags: Operation not permitted
ls: location: Operation not permitted
ls: ext: Operation not permitted
ls: experiment_id: Operation not permitted
ls: file_path: Operation not permitted
Can anyone tell me why despite having global permissions (777) I am still getting operation not permitted?
On running strace, I get the following traces:
lstat("tags", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lgetxattr("tags", "security.selinux", 0x112ae80, 255) = -1 EPERM (Operation not permitted)
write(2, "ls: ", 4ls: ) = 4
write(2, "tags", 4tags) = 4
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1
) = 1
lstat("location", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lgetxattr("location", "security.selinux", 0x112aea0, 255) = -1 EPERM (Operation not permitted)
write(2, "ls: ", 4ls: ) = 4
write(2, "location", 8location) = 8
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1) = 1
lstat("ext", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lgetxattr("ext", "security.selinux", 0x112aec0, 255) = -1 EPERM (Operation not permitted)
write(2, "ls: ", 4ls: ) = 4
write(2, "ext", 3ext) = 3
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1) = 1
lstat("experiment_id", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lgetxattr("experiment_id", "security.selinux", 0x112aee0, 255) = -1 EPERM (Operation not permitted)
write(2, "ls: ", 4ls: ) = 4
write(2, "experiment_id", 13experiment_id) = 13
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1) = 1
lstat("file_path", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lgetxattr("file_path", "security.selinux", 0x112af00, 255) = -1 EPERM (Operation not permitted)
write(2, "ls: ", 4ls: ) = 4
write(2, "file_path", 9file_path) = 9
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1) = 1
So from the trace, it looks like its trying to get the selinux attribute even though its disabled on my system.
cat /etc//sysconfig/selinux
SELINUX=disabled
SELINUXTYPE=targeted
follow the below steps to resolve the issue. I tried below steps, worked for me
1.Pull down the Apple menu and choose ‘System Preferences’
2.Choose “Security & Privacy” control panel
3.Now select the “Privacy” tab, then from the left-side menu select “Full Disk Access”
4.Click the lock icon in the lower left corner of the preference panel and authenticate with an admin level login
5.Now click the [+] plus button to add an application with full disk access
6.Navigate to the /Applications/Utilities/ folder and choose “Terminal” to grant Terminal with Full Disk Access privileges
7.Relaunch Terminal, the “Operation not permitted” error messages will be gone
Set permissions on the directory that contains the files.
Use strace(1) at least as
strace ls -l
this will show you all the syscalls done by ls and you would recognize which FUSE file-system related syscalls(2) are failing.
Perhaps stat(2) is failing on individual directory entries like tags etc...?
You are probably forgetting to implement some operations in your FUSE.
The problem was with my getxattr implementation. I was returning -1 on error which translated to EPERM, instead I should have returned ENODATA which is more correct error case for my logic. This fixed those errors as well.
https://gowalker.org/github.com/hanwen/go-fuse/fuse
Related
I am trying to run the following command in ubuntu terminal
patch -p0 -i adjustmentFile.patch
That is giving the following error
patching file ./src/helpStructures/CastaliaModule.cc
patching file ./src/node/communication/mac/tunableMac/TunableMAC.cc
Hunk #2 FAILED at 456.
1 out of 2 hunks FAILED -- saving rejects to file ./src/node/communication/mac/tunableMac/TunableMAC.cc.rej
I tried almost all the ways suggested in the link Hunk #1 FAILED at 1. What's that mean?. However, nothing worked.
Here is my version detail
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
Included patches: 1-1453
The patch file:
diff -r -u ./src/helpStructures/CastaliaModule.cc ./src/helpStructures/CastaliaModule.cc
--- ./src/helpStructures/CastaliaModule.cc 2010-12-09 09:56:47.000000000 -0300
+++ ./src/helpStructures/CastaliaModule.cc 2011-12-20 00:16:39.944320051 -0300
## -180,6 +180,8 ##
classPointers.resourceManager = getParentModule()->getParentModule()->getSubmodule("ResourceManager");
else if (name.compare("SensorManager") == 0)
classPointers.resourceManager = getParentModule()->getSubmodule("ResourceManager");
+ else if (name.compare("Routing") == 0)
+ classPointers.resourceManager = getParentModule()->getParentModule()->getSubmodule("ResourceManager");
else
opp_error("%s module has no rights to call drawPower() function", getFullPath().c_str());
if (!classPointers.resourceManager)
Only in ./src/helpStructures: CastaliaModule.cc~
diff -r -u ./src/node/communication/mac/tunableMac/TunableMAC.cc ./src/node/communication/mac/tunableMac/TunableMAC.cc
--- ./src/node/communication/mac/tunableMac/TunableMAC.cc 2011-03-30 02:14:34.000000000 -0300
+++ ./src/node/communication/mac/tunableMac/TunableMAC.cc 2011-12-19 23:57:43.894686687 -0300
## -405,6 +405,8 ##
void TunableMAC::fromRadioLayer(cPacket * pkt, double rssi, double lqi)
{
TunableMacPacket *macFrame = dynamic_cast <TunableMacPacket*>(pkt);
+ macFrame->getMacRadioInfoExchange().RSSI = rssi;
+ macFrame->getMacRadioInfoExchange().LQI = lqi;
if (macFrame == NULL){
collectOutput("TunableMAC packet breakdown", "filtered, other MAC");
return;
## -454,7 +456,8 ##
}
case DATA_FRAME:{
- toNetworkLayer(macFrame->decapsulate());
+ cPacket *netPkt = decapsulatePacket(macFrame);
+ toNetworkLayer(netPkt);
collectOutput("TunableMAC packet breakdown", "received data pkts");
if (macState == MAC_STATE_RX) {
cancelTimer(ATTEMPT_TX);
Only in ./src/node/communication/mac/tunableMac: TunableMAC.cc~
Patching takes some changes made to a file X, and applies them to a different instance of file X. That is, suppose you start with generation 1 of file X; you make changes to get generation 2-a, and someone else starts with generation 1 to make generation 2-b. Now you want to take his edits that created his generation 2-b, and apply them to your generation 2-a.
If 'his' changes clash with 'your' changes, they cannot be automatically patched.
You'll need to look at the changes being made in hunk 2.
- toNetworkLayer(macFrame->decapsulate());
+ cPacket *netPkt = decapsulatePacket(macFrame);
+ toNetworkLayer(netPkt);
and figure out what you want the result to look like. Someone needs to know what the result is supposed to be. You can't resolve conflicts without knowledge of intent.
I run hicpipe tools and it returns this error during execution. Its error was:
Rsge temp files: tmp/Rsge.test_cluster.binned.*
Error in if (trace) cat("Running locally \n") :
argument is of length zero
Calls: compute.total.counts -> model.predict.split -> sge.parRapply
Execution halted
Error: error in total_expected_counts_wrapper.r
Execution halted
make[1]: *** [/home/dashti/hicpipe/output/test_cluster/test_cluster.nm]
Error 1
make[1]: Leaving directory `/home/dashti/hicpipe'
make: *** [all] Error 1
It was run a Rscript code in below:
Rscript R/total_expected_counts_wrapper.r /home/dashti/hicpipe/output/test_cluster/test_cluster /home/dashti/hicpipe/models/map_len_gc.mdl trans 1e+06 0 200
Code of total_expected_counts_wrapper.r is :
options(warn=1)
# get script name
all.args = commandArgs(F)
fn.arg = "--file="
script.name = sub(fn.arg, "", all.args[grep(fn.arg, all.args)])
args = commandArgs(T)
if (length(args) == 1) {
cat(sprintf("usage: %s <input prefix> <model file> <filter> <cis.threshold> <use cluster> <max jobs on cluster>\n",
script.name))
q(status=1)
}
ifn.prefix = args[1]
model.ifn = args[2]
filter = args[3]
cis.threshold = as.numeric(args[4])
cluster = (args[5] == "1")
max.njobs = as.numeric(args[6])
mtable = read.delim(model.ifn)
mfields = mtable$field
maxvals = mtable$size
if (cluster) {
cat("Using Sun Grid Engine cluster\n")
} else {
cat("Not using Sun Grid Engine cluster, running sequentially on local machine\n")
}
source("R/model_predict.r")
compute.total.counts(prefix=ifn.prefix, cluster=cluster, max.njobs=max.njobs, ofields=mfields, max.vals=maxvals, filter=filter, cis.threshold=cis.threshold)
q(status=0)
What should I do? I see other .R files but I cannot find any trace variable in them. I send an E-mail to authors but I do not receive any response.
source("R/model_predict.r")
In model_predict.r, Rsge library is loaded
173 library(Rsge)
174 sge.options(sge.save.global=F)
175 sge.prefix = paste("tmp/Rsge.", get.short.fn(fends.fn), ".", sep="")
176 cat(sprintf("Rsge temp files: %s*\n", sge.prefix))
177 sge.options(sge.file.prefix=sge.prefix)
178
179 result = sge.parRapply(ranges, model.predict, lib.dir=lib.dir,
180 njobs=njobs, join.method=c, cluster=cluster,
181 fends.fn=fends.fn, log.dir=log.dir,
182 prior=prior, mfields=mfields, mfields.maxvals=mfields.maxvals, mfields.fns=mfields.fns,
183 filter=filter, cis.threshold=cis.threshold, ofields.x=ofields.x, ofields.y=ofields.y,
184 function.savelist=c("get.short.fn", "get.ofield.args"))
185 if (class(result) == "list" && class(result[[1]]) == "try-error")
186 return (-1)
and it seems that Rsge does not work properly.
I workarounded by editing Rsge/sge.parApply.R code
(set value of variables equal to Rsge/sge.optionR)
and reinstalling Rsge.
1
2 # $Id: sge.parRapply.R,v 1.2 2006/12/15 15:21:23 kuhna03 Exp $
3
4 sge.apply <- function(X, MARGIN, FUN, ...,
5 join.method=cbind,
6 njobs,
7 batch.size=options('sge.block.size'),
8 packages=NULL,
9 global.savelist=NULL,
10 function.savelist=NULL,
11 cluster=options('sge.use.cluster'),
12 #trace=options('sge.trace'),
13 trace=TRUE,
14 #debug=options('sge.debug'),
15 debug=FALSE,
16 file.prefix=options('sge.file.prefix')
17 ) {
I am currently monitoring multiple systems' OS (Unix) filesystem utilization and DB (Sybase) utilization. I would like to query those in one file using the vi editor. My script goes like this:
df -h
su - sybpg1
isql -Usapsa -SPG1 -PMaster4SID -w999 -X
declare #pagesize numeric(19,0)
select #pagesize=(select ##maxpagesize)
SELECT "Database Name" = CONVERT(char(30), db_name(D.dbid)),
"Data Size MB" = STR(SUM(CASE WHEN U.segmap != 4 THEN U.size*#pagesize/1048576 END),10,1),
"Used Data MB" = STR(SUM(CASE WHEN U.segmap != 4 THEN size - curunreservedpgs(U.dbid, U.lstart, U.unreservedpgs)END)*#pagesize/1048576,10,1),
"Data Full%" = STR(100 * (1 - 1.0 * SUM(CASE WHEN U.segmap != 4 THEN curunreservedpgs(U.dbid, U.lstart, U.unreservedpgs) END)/SUM(CASE WHEN U.segmap != 4 THEN U.size END)),9,1) ,
"Log Size MB" = STR(SUM(CASE WHEN U.segmap = 4 THEN U.size*#pagesize/1048576 END),10,1),
"Free Log MB" = STR(lct_admin("logsegment_freepages",D.dbid)*#pagesize/1048576,10,1),
"Log Full%" = STR(100 * (1 - 1.0 * lct_admin("logsegment_freepages",D.dbid) /
SUM(CASE WHEN U.segmap = 4 THEN U.size END)),8,1)
FROM master..sysdatabases D,
master..sysusages U
WHERE U.dbid = D.dbid
AND ((D.dbid != 2))
GROUP BY D.dbid
ORDER BY db_name(D.dbid)
go
but whenever i execute:
sh filename
It was able to enter sybase, however couldn't get pass through the isql line.
It goes something like this:
sybsid.sh: line 6: isql: command not found
Hope you could help me out.
Thanks!
I try to show tail of a text file. If file is small, there is no difference. However if file is too big (~5 gB), tailf does not respond. On the other hand tail -f works fine. What is difference between them?
I have faced the same issue. The log file was about 47GB. The tailf just waits almost infinite. But the tail -f begin to print the output within seconds.
I have digged deeper by examining the underlying system calls using strace command. The results given below:
# strace tailf /var/log/messages
(truncated)
stat("/var/log/messages", {st_mode=S_IFREG|0600, st_size=47432599401, ...}) = 0
open("/var/log/messages", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=47432600425, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7dba2d1000
read(3, "Nov 1 03:23:01 hostnameXXXX"..., 4096) = 4096
read(3, "0.31.148.12)\nNov 1 03:54:33 del"..., 4096) = 4096
read(3, "io.c(600) [receiver=3.0.6]\nNov "..., 4096) = 4096
(truncated)
As you can see, the tailf is trying to read (buffer) all the lines from beginning before generating output to the screen.
Check the output of tail -f below, here it is using the system call lseek (C/C++) to directly jump to end of file and start reading from there:
# strace tail -f /var/log/messages
(truncated)
open("/var/log/messages", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=47294167448, ...}) = 0
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_END) = 47294170917
lseek(3, 47294169088, SEEK_SET) = 47294169088
(truncated)
From the man page:
tailf will print out the last 10 lines of a file and then wait for the
file to grow. It is similar to tail -f but does not access the file
when it is not growing. This has the side effect of not updating the
access time for the file, so a filesystem flush does not occur periodi-
cally when no log activity is happening.
http://linuxcommand.org/man_pages/tailf1.html
If it doesn't access the file directly it will have some difficulties with very lage files, depending on your machines setup.
Does anyone know the api for adding users and groups in unix and removing them ? I want to do this programatically.
Thanks,
Frank
I started looking at some system calls and found the following. Note that they are of varying standards, so not all may work on your Unix version:
getpwent
setpwent
putpwent
These however, all assume a password file. Out of curiosity, I straced useradd to find out what he did. Here's a small section of it's output:
# grep -E 'passwd|shadow' useradd.log.20283
...
open("/etc/shadow", O_RDONLY|O_CLOEXEC) = 3
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
open("/etc/passwd.20283", O_WRONLY|O_CREAT|O_EXCL, 0600) = 4
link("/etc/passwd.20283", "/etc/passwd.lock") = 0
stat("/etc/passwd.20283", {st_mode=S_IFREG|0600, st_size=6, ...}) = 0
unlink("/etc/passwd.20283") = 0
open("/etc/passwd", O_RDWR) = 4
open("/etc/shadow.20283", O_WRONLY|O_CREAT|O_EXCL, 0600) = 5
link("/etc/shadow.20283", "/etc/shadow.lock") = 0
stat("/etc/shadow.20283", {st_mode=S_IFREG|0600, st_size=6, ...}) = 0
unlink("/etc/shadow.20283") = 0
open("/etc/shadow", O_RDWR) = 5
open("/etc/gshadow.20283", O_WRONLY|O_CREAT|O_EXCL, 0600) = 7
link("/etc/gshadow.20283", "/etc/gshadow.lock") = 0
stat("/etc/gshadow.20283", {st_mode=S_IFREG|0600, st_size=6, ...}) = 0
unlink("/etc/gshadow.20283") = 0
open("/etc/gshadow", O_RDWR) = 7
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 8
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 9
open("/etc/passwd-", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 9
utime("/etc/passwd-", [2010/09/02-07:07:34, 2010/09/02-07:07:34]) = 0
open("/etc/passwd+", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
lstat("/etc/passwd", {st_mode=S_IFREG|0644, st_size=2479, ...}) = 0
rename("/etc/passwd+", "/etc/passwd") = 0
open("/etc/shadow-", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
utime("/etc/shadow-", [2010/09/02-07:07:34, 2010/09/02-07:07:34]) = 0
open("/etc/shadow+", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
lstat("/etc/shadow", {st_mode=S_IFREG|0600, st_size=1429, ...}) = 0
r ename("/etc/shadow+", "/etc/shadow") = 0
open("/etc/gshadow-", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
utime("/etc/gshadow-", [2010/09/02-07:07:34, 2010/09/02-07:07:34]) = 0
open("/etc/gshadow+", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
lstat("/etc/gshadow", {st_mode=S_IFREG|0400, st_size=1069, ...}) = 0
rename("/etc/gshadow+", "/etc/gshadow") = 0
unlink("/etc/shadow.lock") = 0
unlink("/etc/passwd.lock") = 0
unlink("/etc/gshadow.lock") = 0
Although you get a better idea what's going on with the full context, note that it links a temporary file it created (/etc/passwd.20283) to /etc/passwd.lock. useradd does similarly with the shadow, and gshadow files as well.
It's also important to note that useradd made four calls out to nscd. Two of these were for passwd, and two were for group:
execve("/usr/sbin/nscd", ["/usr/sbin/nscd", "nscd", "-i", "passwd"], [/* 0 vars */]) = 0
If there isn't an API (and I can't seem to find one), it may be because there's many more ways to store users than simple passwd files. Indeed, it's possible that the machine has no control at all over the users.
EDIT: I suppose it's also important to note that useradd consulted /etc/nsswitch.conf as well, likely to verify the origin of the user database. Furthermore, userdel behaved almost identically, creating similarly named temporary and lock files.
I tested under Linux using the following command:
strace -o useradd.log -f -ff -s 1024 useradd tempuser
strace may also appear as truss and ktrace on other unix systems.
I found this question while looking for a way to list all groups on a Unix.
But to create and delete users you can programatically call the utility programs useradd, userdel, groupadd, groupdel since you would know the user name been sent. But I guess you will need superuser rights to invoke them. Anyway you can check the process exit code for command status.
useradd xxx // status zero operation completed
useradd xxx // status nine user already exists
Hope it helps.