On 13/06/17 15:08, DJ VIN Lom wrote: > Can i create a script to have my pi change to a certian directory > automaticlly after booting.
You have some serious misconceptions about how the Pi works. The Pi does not have any idea of a "directory" when it boots up. The whole concept of a home directory is related to users. When a user logs in the shell sets a variable to indicate that users home directory - you can have multiple users logging into your Pi at once and they each have a different home directory. But users log in after the Pi has booted - and it could be seconds, minutes, hours or days after before the first user logs in. Having established that it's your login that needs to be addressed we can look at how to set or change your home directory. One way is in your user definition in /etc/passwd. There is a field there that states where the user goes when they login and you can edit that. Secondly when your shell starts up it executes various startup scripts, depending on which shell you use. Assuming its bash you can put commands into .bashrc in your home directory, including a 'cd' to change to wherever you want. Finally, since you mention a Python script that concerns you then you can put commands into the script itself to change to any given directory before doing anything else. Use import os os.chdir(<"/your chosen/folder") > I want it to be in a directory so when i ssh > into it its ready and i dont need to spend time to do it. If it's about being in the right place at login you probably should just change the login directory in /etc/passwd. Although this begs the question why you don't want to use the default /home/userid directory? Maybe you should be creating links or aliases to the files you need? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor