Tag Info

Hot answers tagged

7

You can using fstab module. Its documentation here. Example: fstab = Fstab() for entry in fstab.entries: pprint.pprint(entry)


4

This will not work because /etc/fstab file doesn't conform to the format the ConfigParser supports. As man 5 fstab indicates, the /etc/fstab file is a whitespace separated file with 6 columns. The Python ConfigParser is a library for Parsing files commonly known as .ini files that, simplified, consist of sections that contain key/value pairs: ...


3

One of the things to look out for when cloning Linux systems is udev's persistent network device naming rules. udev may create and update the file /etc/udev/rules.d/70-persistent-net.rules to map MAC addresses to interface names. It does this with the script /lib/udev/write_net_rules. Each MAC address (with some exceptions; see ...


3

Take a backup as, cp /etc/nsswitch.conf /etc/nsswitch.conf.orignal Now you can use sed -i or open /etc/nsswitch.conf with some editor like vim and do the changes. If error occurs, you can revert back to the original version, cp /etc/nsswitch.conf.original /etc/nsswitch.conf I got this tool suggestion by Ulrich in the chat which is used for editing the ...


2

This task is an example of "configuration management". As you might expect, many other people have also had the same questions as you. The general class of software that performs this function is called configuration management software. Some popular examples are: Chef Puppet SaltStack


2

I would recommend using augtool from augeas. Puppet and other configuration management tools integrate with augeas and allow you the safe and syntactically correct way to manipulate configuration files. Augeas is a tool to transfer configuration files into a tree, which you can query and modify. It ensures that the modification are syntactically correct ...


2

In /etc/default/grub I changed this: GRUB_CMDLINE_LINUX_DEFAULT="text nomodeset acpi_backlight=legacy" to: GRUB_CMDLINE_LINUX_DEFAULT="text nomodeset" update-grub, reboot, and start mdm by hand: /etc/init.d/mdm start No idea why the backlight should suddenly break.


2

Use sudo -E to preserve your environment: $ export FOO=1 $ sudo -E env | grep FOO FOO=1 That will preserve $HOME and any other environment variables you had, so the same configuration files you started with will be accessed by the programs running as root. You can update sudoers to disable the env_reset setting, which clears out all environment variables ...


2

Building on @mark-plotnick 's remark: The new hardware has a different mac address. The old mac address is still hard coded in /etc/udev/rules.d/70-persistent-net.rules. You could simply rename this file. In that case rebooting will recreate the file with the new mac address.


1

Set up sudo to preserve the HOME environment variable. Run visudo to edit the sudo configuration. Make sure that the option always_set_home is not set, and that HOME is present in the env_keep list. Add the following lines: Defaults !always_set_home Defaults env_keep+="HOME" Remove a line like Defaults always_set_home if there is one.


1

If you already use firewall software that fulfils its purpose and that you know how to use, but lacks this facility, I suggest you stick with it. The switch from, or addition to, an application using a single configuration file to a directory whose file contents are taken combined to be the configuration, is often made because of package maintainability. ...


1

I wrote a small python script that takes care of this problem. The logic looks at each line in the file package.accept_keywords and only acts on lines that start with = or <=. These lines have a maximum bound version so we can check if they are needed anymore. Lines without a qualifier or a >= are left as-is as we cannot know if they are obsolete. ...



Only top voted, non community-wiki answers of a minimum length are eligible