Recently I am using the virtual machine to do the Python coding. The system is under Linux, which means I have to use Command Lines to install the Python packages. I am familiar with Anaconda to do Python coding at school. But in the real working environment, to save money, I have to use Linux. Now I have a p…
Tag: python
Can’t assign password to user with ansible user module
When I run this it does what it’s supposed to do. It creates the user and the home directory that I specify. It also prints out a password and the hash but I can’t log change to this user no matter what I do. Any suggestions on how I can get a password assigned to this user correctly would be
What would be an optimal way to perform DNS query from bash in python3?
I have this simple bash script that I’m thinking about incorporating into my python project as I couldn’t figure out a graceful way to do this in python3 compared to this single bash oneliner. Is there a better way to do this in python3 or a library that would assist with storing all legitimate un…
How to run python code from linux via a docker containing a specific python version
I have a linux server running in which I want to be able to run some python scripts. To do so, I created a docker image of python (3.6.8) with some specific dependencies to run my code. I am new to linux command line and need help on how to write a line that would run a given python script
I have integrated a bash command into my Python code – how can I get this command to take an input from the shell?
I have added a bash command to my Python script – this bash command is used to linearise an input file (i.e. take a file with many lines, and merge it into one line). It works when I manually write the name of the file for the command (in this example, the input file is called input.txt): However, I wou…
Convert the output of ls in a python list [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 3 years ago. Improve this question I get…
How do I access a file for reading/writing in a different (non-current) directory?
I am working on the listener portion of a backdoor program (for an ETHICAL hacking course) and I would like to be able to read files from any part of my linux system and not just from within the directory where my listener python script is located – however, this has not proven to be as simple as specif…
Write background command output (stdout) to file during execution
I have a command that takes a long time that I like to run in the background like this: This works perfectly in the sense that the command is indeed in the background and I can check the output and potential errors later. The main problem is the output is only appended after the command is completely finished…
How can I automate the user creation in Linux servers using Python
Well I’m trying to create a script to automate the user creation in Linux servers, so I generated the ssh keys in each server and made a code like this: But, I’m getting the error: When I remove ssh myuser@lab part, the script work in the localhost. Could someone help me with this issue? Answer Yo…
First file path value not added into array on linux ubuntu
Running a python script on linux The for loop will run twice and 2 pngs will be added into the array. However, only the 2nd one was added into the array. Not too sure why the first one is missing from the array. When i try to print the entire path, the entire path is showing. Example of the file