[opensuse-autoinstall] [13.1] Creating a file in the user's home
Hi, As part of my autoinst.xml file I want to place a file in a specific user's home. Initially I tried to do it with a post-script, but that failed since the user's home was not yet created <script> <filename>post-install-vagrant-ssh-key</filename> <network_needed config:type="boolean">true</network_needed> <source><![CDATA[#!/bin/bash cd /home/vagrant mkdir -m 700 .ssh curl -o .ssh/authorized_keys 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' chmod 600 .ssh/authorized_keys chown -R vagrant .ssh ]]> </source> </script> I also tried using files/file section, but that seemed be completely ignored. According to [1] this should work without any issues in 13.1. <files> <file> <file_path>/home/vagrant/.ssh/authorized_keys</file_path> <!-- <file_location>https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub</file_location> --> <file_contents><![CDATA[ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key]]></file_contents> <file_owner>vagrant</file_owner> <file_permissions>600</file_permissions> </file> </files> I tried both the file_contents and file_location variants ( one is commented out above ). What's the best way of placing a file in the user's home directory using autoinst.xml ? Thanks, Robert [1]: http://doc.opensuse.org/projects/autoyast/configuration.html#createprofile.c... -- http://robert.muntea.nu/ -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-autoinstall+owner@opensuse.org
On Thu, Jul 31, 2014 at 6:12 PM, Robert Munteanu <robert.munteanu@gmail.com> wrote:
<files>
I noticed that this should be <files config:type="list"> , but again, it did not make a difference. I was able to create a file under /etc , but not under /home/vagrant/.ssh . Is there an alternative to creating all the intermediate directories? Thanks, Robert -- http://robert.muntea.nu/ -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-autoinstall+owner@opensuse.org
Hi, On Thu, Jul 31, Robert Munteanu wrote:
Hi,
As part of my autoinst.xml file I want to place a file in a specific user's home. Initially I tried to do it with a post-script, but that failed since the user's home was not yet created
I assume you create the user as part of the <users> section in autoinst.xml . post-scripts are called before second stage configuration (like e.g. creating users) are done so the user and its home dir does not yet exist. Solutions: 1) You could use a init-script, it is run after all configuration is done and all services are up and running 2) you create the user via a call to useradd in the post-script before putting the file into its home directory. In this case the user should be removed from <users> section in autoinst.xml Bye, Thomas Fehr -- Thomas Fehr, SuSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Tel: +49-911-74053-0, Fax: +49-911-74053-482, Email: fehr@suse.de GPG public key available. -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-autoinstall+owner@opensuse.org
On Thu, Jul 31, 2014 at 6:59 PM, Thomas Fehr <fehr@suse.de> wrote:
Hi,
On Thu, Jul 31, Robert Munteanu wrote:
Hi,
As part of my autoinst.xml file I want to place a file in a specific user's home. Initially I tried to do it with a post-script, but that failed since the user's home was not yet created
I assume you create the user as part of the <users> section in autoinst.xml . post-scripts are called before second stage configuration (like e.g. creating users) are done so the user and its home dir does not yet exist.
Solutions: 1) You could use a init-script, it is run after all configuration is done and all services are up and running
A init-script worked perfectly, thank you. Robert
2) you create the user via a call to useradd in the post-script before putting the file into its home directory. In this case the user should be removed from <users> section in autoinst.xml
Bye, Thomas Fehr -- Thomas Fehr, SuSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Tel: +49-911-74053-0, Fax: +49-911-74053-482, Email: fehr@suse.de GPG public key available. -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-autoinstall+owner@opensuse.org
-- http://robert.muntea.nu/ -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-autoinstall+owner@opensuse.org
participants (2)
-
Robert Munteanu
-
Thomas Fehr