小编Kir*_*127的帖子

Pam.exec 退出代码 8

我正在尝试使用pam.d在用户登录时执行脚本。现在我正在编辑该/etc/pam.d/su文件。每次我登录用户时都会收到“退出代码 8”。

我使用的命令:

session optional pam_exec.so /etc/calendar/test
Run Code Online (Sandbox Code Playgroud)

该路径/etc/calendar/test是测试脚本的路径:

echo hi
Run Code Online (Sandbox Code Playgroud)

最终我将实现一个脚本来记录登录的用户和时间:

user=$(whoami)
date=$(date)
echo $user logged in at $date >> /etc/calendar/tripwire_file
Run Code Online (Sandbox Code Playgroud)

对此问题提供的任何见解将不胜感激。

linux bash scripting pam

2
推荐指数
1
解决办法
1946
查看次数

循环不在Python 3中工作

我最初在python 2中编写了这个程序,它工作正常,然后我切换到python 3,while循环工作.

我运行程序时没有出现任何错误,但它不会检查运行前或运行期间i的值.无论如何,while循环和第一个if循环都将运行.

#imports the random module
import random

#Creates variable that is used later
i = 0

#chooses a random number betweeen 1 - 100
randomNumber = random.randint(1,10)

#prints the number
print (randomNumber)

#Creates while loop that runs the program until number is guessed
while i == 0:

    #Creates a variable where the answer will be stored, and then asked the question in the quotes
    user_answer = input("Try to guess the magic number. (1 - 10) ")

    print …
Run Code Online (Sandbox Code Playgroud)

python loops python-3.x

-1
推荐指数
1
解决办法
129
查看次数

标签 统计

bash ×1

linux ×1

loops ×1

pam ×1

python ×1

python-3.x ×1

scripting ×1