Find the answer to your Linux question:
Results 1 to 4 of 4
OK, my question will probably be easy but i have no clue where to start with this. I have a logon script set in the startup folder "All Users > ...
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    5

    Windows Equivelant - Logon Batch Scripts

    OK, my question will probably be easy but i have no clue where to start with this. I have a logon script set in the startup folder "All Users > Startup > logon.bat" and it nicely mounts network drives from a Windows Server 2003 computer. The script is as follows:

    <logon.txt (.bat) attachment>

    Very simple. Now what I need to know:
    - What is a batch equivalent and what commands will I need?
    - Where is/how do I use the equivalent to Startup folder
    - Can I get it to mount in the Computer folder or will it be mounted through root ("/") or can I have it easily accessible (maybe the Desktop)?
    - Is there a way I can get the equivalent to the Windows password vault (remember passwords for certain addresses) and;
    - If not, can I get the script to request Username and Password from the user for the mapping?
    - Can I write to the folders if the user has permissions to write (had trouble with smbmount doing this)

    Thanks for your help,
    Another newbie
    Attached Files Attached Files

  2. #2
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    855
    There are many ways to accomplish this. You could put it into /etc/fstab and it will be mounted at boot before users log in. You could mount it also from rc.local. You could mount it from user login files like bashrc, you could have it even mounted from DE startup files, either system or user. You are free to choose any mount point you like, be it in /media or users home or users desktop.
    As you can see, for Linux beginners the choice is overwhelming.

  3. #3
    Just Joined!
    Join Date
    Sep 2010
    Posts
    5
    Quote Originally Posted by Segfault View Post
    There are many ways to accomplish this. You could put it into /etc/fstab and it will be mounted at boot before users log in. You could mount it also from rc.local. You could mount it from user login files like bashrc, you could have it even mounted from DE startup files, either system or user. You are free to choose any mount point you like, be it in /media or users home or users desktop.
    As you can see, for Linux beginners the choice is overwhelming.
    Sounds good to me, now I just need to create the script. How do I code the commands into a file to make it execute within the terminal? Just like a Windows batch file.

    Thanks for your replies.

  4. #4
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    855
    In /etc/fstab it will be just one line, no script needed. See man fstab and man mount for syntax.

    Generally, script is just a file with a command in it. Example contents of myscript below.

    Code:
    /path/to/mycommand
    This file can have the executable bit set to be executed by shell. See man chmod. Following command will run it:

    Code:
    myscript
    If it does not have the executable bit set you can still execute it like this:

    Code:
    bash myscript
    Bash is just an example, use the shell you want.

    If you do not want to run it in your current session but want open another instead you can add shebang:

    Code:
    #!/bin/bash [options]
    
    /path/to/mycommand
    Well, all this and much more is explained in Advanced Bash-Scripting Guide.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...