0600 linux权限,linux – 覆盖文件时拒绝sed权限

我试图使用sed覆盖我的index.php文件,但我收到一个错误:

$sed -i 's@

@@' index.php

sed: couldn't open temporary file ./sedmZNx8T: Permission denied

有谁知道如何解决这一问题?

解决方法:

好像你在/ tmp目录上有权限问题. (如下所述,您在phpshell中运行命令,因此TMP目录可以在/ tmp之外设置)

它应该看起来像:

$ls -ld /tmp

drwxrwxrwx 333 root root 32768 12 oct. 03:13 /tmp/

说明

当使用-i标志调用sed时,sed在/ tmp目录中创建一个临时文件.

strace证明:

$strace -f -e trace=file sed -i 's/a/z/' /tmp/a

execve("/bin/sed", ["sed", "-i", "s/a/z/", "/tmp/a"], [/* 94 vars */]) = 0

access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3

(...)

open("/tmp/sedPSBTPG", O_RDWR|O_CREAT|O_EXCL, 0600) = 4

rename("/tmp/sedPSBTPG", "/tmp/a") = 0

+++ exited with 0 +++

标签:linux,sed

来源: https://codeday.me/bug/20190620/1247504.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值