如何在一个Ubuntu中的多个帐户中使用没有Sudo的Git?
我的Ubuntu有很多账号.新帐户的创建使我无法访问Git,没有sudo.
我改变了所有者是我,马嘶,并且该组将admin在马嘶属于.我有Git的以下权限
800 -rwxrwxrwx 1 masi admin 813744 2009-02-20 23:01 /usr/bin/git
Run Code Online (Sandbox Code Playgroud)
在尝试使用Git时,我收到以下消息
git status
fatal: unable to create '.git/index.lock': Permission denied
Run Code Online (Sandbox Code Playgroud)
我运行find . -iregex ".*index.l.*它返回没有匹配,所以似乎没有index.lock锁定系统.我也用sudo运行相同的命令失败了.
我目前正在编写shell.我执行进程并利用SIGCHLD信号处理程序在它们完成时清理(等待它们).
一切都在工作 - 除非我执行升级权限的进程sudo.在这些情况下,我从来没有得到过SIGCHLD信号 - 所以我永远不知道这个过程已经完成了.
当我收到诸如此类的命令时sudo ls,我执行程序sudo然后提供ls参数.我执行此执行execvp.
如果我在ps -auxshell执行后看一下sudo ls,我会看到以下内容:
root 4795 0.0 0.0 4496 1160 pts/29 S+ 16:51 0:00 sudo ls
root 4796 0.0 0.0 0 0 pts/29 Z+ 16:51 0:00 [ls] <defunct>
Run Code Online (Sandbox Code Playgroud)
因此,sudo在分配pid = 4795了孩子(ls)的情况下,跑步和分配4796.孩子已完成任务,现在正处于一个僵尸状态.sudo似乎并不想收获僵尸进程而只是坐在那里.
我想知道是什么原因造成这种现象-我已经尝试了不同的技术来清除这些僵尸进程,比如下运行我的壳sudo和等待直接sudo和PID其sudo执行(在上面的例子中4796).这些技术都没有奏效.
一如既往,任何建议都表示赞赏.
有人可以帮我解决这个错误吗?
octave:4> pkg install signal-1.2.0.tar.gz
error: the following dependencies where unsatisfied:
signal needs optim >= 1.0.0
signal needs specfun >= 0.0.0
signal needs control >= 2.2.3
signal needs general >= 1.3.2
octave:4> pkg install optim-1.2.2.tar.gz
error: the following dependencies where unsatisfied:
optim needs miscellaneous >= 1.0.10
optim needs struct >= 1.0.10
octave:4> pkg install struct-1.0.10.tar.gz
make: /usr/bin/mkoctfile: Command not found
make: *** [fields2cell.oct] Error 127
'make' returned the following error: make: Entering directory `/tmp/oct-fDBs5k/struct-1.0.10/src'
/usr/bin/mkoctfile -s fields2cell.cc
make: Leaving directory …Run Code Online (Sandbox Code Playgroud) 我有以下内容
#!/bin/bash
USER='scott'
PASS='tiger'
ssh -t $USER@server006.web.com "sudo su - http"
Run Code Online (Sandbox Code Playgroud)
这是Works,但我试图让它在之后运行一个脚本,如果我这样做,使用-c或<
该脚本像这样做一个grep:
grep -i "Exception:" /opt/local/server/logs/exceptions.log | grep -e "|*-*-*:*:*,*|" | tail -1 | awk -F'|' '{print $2}' >> log.log
Run Code Online (Sandbox Code Playgroud)
这也适用于它自己,但我需要http才能做到这一点.
我也不能把SCP的输出输回到server001,所以我被困在这里,
任何想法都会被接受赞赏.本
看看将当前用户的别名传递给sudo命令的方法,我在ArchWiki上找到了以下内容:
传递别名
如果您使用了很多别名,您可能已经注意到在使用sudo时它们不会转移到root帐户.但是,有一种简单的方法可以使它们工作.只需将以下内容添加到您
~/.bashrc或/etc/bash.bashrc:
alias sudo='sudo '
我不明白为什么会这样.如果shell不关心两个命令之间有多少空格,这怎么会有效?
手动添加空格时,我认为没有区别:
$ alias e=echo
$ sudo e foo
sudo: e: command not found
$ sudo e foo # Manual space addition
sudo: e: command not found # Fail
$ alias sudo="sudo " # Now with alias
$ sudo e foo
foo # Succeeds, but why?
Run Code Online (Sandbox Code Playgroud)
可见别名sudo到sudo + space以某种方式允许传递别名.这部作品zsh,bash并且sh,所以它不是一个特定的壳行为.
在我的Python脚本中,我执行了一些需要root权限的操作.我还创建和写入我不希望由root独占但由运行我的脚本的用户拥有的文件.
通常,我使用我的脚本sudo.有没有办法做到这一点?
如何以root权限从启动器运行Pycharm?
我可以从终端窗口做到这一点sudo ./pycharm.sh,但是我想直接从启动器做同样的事情.
我正在与一个可以进行根级调用而无需提供密码的用户一起运行。我的用户目前做这样的事情
pr = subprocess.Popen("sudo sleep 100".split())
sleep(5)
pr.kill()
Run Code Online (Sandbox Code Playgroud)
但这会导致此错误,因为用户不是 root,因此它无法杀死 root 进程
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 1572, in kill
self.send_signal(signal.SIGKILL)
File "/usr/lib/python2.7/subprocess.py", line 1562, in send_signal
os.kill(self.pid, sig)
OSError: [Errno 1] Operation not permitted
Run Code Online (Sandbox Code Playgroud)
所以我尝试做这样的事情
pr = subprocess.Popen("sudo sleep 100".split())
sleep(5)
kill_pr = subprocess.Popen("sudo kill {}".format(pr.pid))
Run Code Online (Sandbox Code Playgroud)
但这并没有杀死有问题的进程。例如,如果
>> subprocess.Popen("sudo sleep 100".split()).pid
5000
Run Code Online (Sandbox Code Playgroud)
但
$ pgrep sleep
5001
Run Code Online (Sandbox Code Playgroud)
所以似乎pid返回的subprocess.Popen("..").pid值比运行我想杀死的命令的进程的实际 pid 高一个
我假设pid从Popen调用返回的是父进程,所以我尝试做类似的事情
sudo …
我正在尝试在我的 WSL Ubuntu 上安装 postgres。安装完成,但是当我运行时,psql显示以下错误。
psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
当我运行sudo find /var/run/postgresql/.s.PGSQL.5432查找该文件时,它显示另一个类似这样的错误。
postgres is not in the sudoers file. This incident will be reported.
从截图中会更清楚。
如何继续?请帮忙...
截屏:
我是 MongoDB 新手,我正在尝试安装 MongoDb-community@4.2 以在 Mac 上使用 mongo,我一步步进行了所有这些步骤:
sudo brew install mongodb
mkdir -p /data/db
sudo chown -R -un' /data/db
mongo或者mongod
直到我在终端上得到这个:
{"t":{"$date":"2022-03-08T20:19:25.376+01:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2022-03-08T20:19:25.377+01:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
{"t":{"$date":"2022-03-08T20:19:25.377+01:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":989}}
{"t":{"$date":"2022-03-08T20:19:25.377+01:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
mac@macs-MacBook-Pro ~ % mongod --dbpath ~/data/db
{"t":{"$date":"2022-03-08T20:21:23.974+01:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-03-08T20:21:23.974+01:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2022-03-08T20:21:23.974+01:00"},"s":"W", …Run Code Online (Sandbox Code Playgroud)